Skip to content

Commit 1aca450

Browse files
committed
Visual Studio does not strip trailing zeros in hexfloat mode, value is in range
1 parent 4af07fc commit 1aca450

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

jbmc/unit/java_bytecode/expr2java.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,37 @@ TEST_CASE(
9696
SECTION("Hex float to string (print a comment)")
9797
{
9898
const float value = std::strtod("0x1p+37f", nullptr);
99+
#ifndef _MSC_VER
99100
REQUIRE(
100101
floating_point_to_java_string(value) == "0x1p+37f /* 1.37439e+11 */");
102+
#else
103+
REQUIRE(
104+
floating_point_to_java_string(value) ==
105+
"0x1.000000p+37f /* 1.37439e+11 */");
106+
#endif
101107
}
102108

103109
SECTION("Hex double to string (print a comment)")
104110
{
105111
const double value = std::strtod("0x1p+37f", nullptr);
112+
#ifndef _MSC_VER
106113
REQUIRE(
107114
floating_point_to_java_string(value) == "0x1p+37 /* 1.37439e+11 */");
115+
#else
116+
REQUIRE(
117+
floating_point_to_java_string(value) ==
118+
"0x1.000000p+37 /* 1.37439e+11 */");
119+
#endif
108120
}
109121

110122
SECTION("Beyond numeric limits")
111123
{
124+
#ifndef _MSC_VER
112125
REQUIRE(
113126
floating_point_to_java_string(-5.56268e-309)
114127
.find("/* -5.56268e-309 */") != std::string::npos);
128+
#else
129+
REQUIRE(floating_point_to_java_string(-5.56268e-309) == "-5.56268e-309");
130+
#endif
115131
}
116132
}

0 commit comments

Comments
 (0)