Skip to content

Fix bug in the printing of double for limit values #4498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified jbmc/regression/jbmc/double1/double1.class
Binary file not shown.
8 changes: 8 additions & 0 deletions jbmc/regression/jbmc/double1/double1.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,13 @@ public static void main(String[] args)
d=java.lang.Double.NEGATIVE_INFINITY;
d=java.lang.Double.NaN;
}

public static String testLimit(double inputValue) {
if(0x1p-1022 == inputValue){
assert(false);
return "reach";
}
return "default";
}
}

11 changes: 11 additions & 0 deletions jbmc/regression/jbmc/double1/test-limit.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CORE
double1.class
--function double1.testLimit --trace
^EXIT=10$
^SIGNAL=0$
^VERIFICATION FAILED$
INPUT arg0d: 0x1(\.0*)?p-1022 /\* 2.22507e-308
--
^warning: ignoring
--
Test double value are printed with sufficient precision
2 changes: 0 additions & 2 deletions jbmc/src/java_bytecode/expr2java.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ std::string floating_point_to_java_string(float_type value)
return raw_decimal;
}();
const bool is_lossless = [&] {
if(value == std::numeric_limits<float_type>::min())
return true;
try
{
return std::stod(decimal) == value;
Expand Down