Skip to content

Commit ef21d6e

Browse files
committed
Visual Studio does not strip trailing zeros in hexfloat mode
1 parent 5383548 commit ef21d6e

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) == "0x1.000000p+37f /* 1.37439e+11 */");
105+
#endif
101106
}
102107

103108
SECTION("Hex double to string (print a comment)")
104109
{
105110
const double value = std::strtod("0x1p+37f", nullptr);
111+
#ifndef _MSC_VER
106112
REQUIRE(
107113
floating_point_to_java_string(value) == "0x1p+37 /* 1.37439e+11 */");
114+
#else
115+
REQUIRE(
116+
floating_point_to_java_string(value) == "0x1.000000p+37 /* 1.37439e+11 */");
117+
#endif
108118
}
109119

110120
SECTION("Beyond numeric limits")
111121
{
122+
#if 0
112123
REQUIRE(
113124
floating_point_to_java_string(-5.56268e-309)
114125
.find("/* -5.56268e-309 */") != std::string::npos);
126+
#else
127+
REQUIRE(
128+
floating_point_to_java_string(-5.56268e-309) ==
129+
"-5.56268e-309 /* -5.56268e-309 */");
130+
#endif
115131
}
116132
}

0 commit comments

Comments
 (0)