Skip to content

Commit

Permalink
Fix #46
Browse files Browse the repository at this point in the history
  • Loading branch information
sparkprime committed Apr 23, 2015
1 parent 842c63f commit 85cbd1a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ std::string jsonnet_unparse_number(double v)
{
std::stringstream ss;
if (v == floor(v)) {
ss << long(v);
ss << std::fixed << std::setprecision(0) << v;
} else {
// See "What Every Computer Scientist Should Know About Floating-Point Arithmetic"
// Theorem 15
Expand Down
2 changes: 2 additions & 0 deletions test_suite/arith_float.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,6 @@ std.assertEqual(4.5 >= 5, false) &&

std.assertEqual(4.5 == 4.5, true) &&
std.assertEqual(4.5 != 3.5, true) &&

std.assertEqual(std.toString(1e20), "100000000000000000000") &&
true

0 comments on commit 85cbd1a

Please sign in to comment.