Support scientific notation for floating point

This commit is contained in:
Glen Fraser
2015-04-29 19:40:58 +02:00
parent 86ec14c2c8
commit d762ef08b6
2 changed files with 50 additions and 8 deletions

View File

@@ -5,3 +5,15 @@ assert_equal(1.2, 1.2)
assert_equal(true, .5 > 0)
assert_equal(true, .5 < 1)
assert_equal(0.5, .5)
// Scientific notation tests
assert_equal(to_string(-1.7e30f), "-1.7e+30")
assert_equal(to_string(+17.9E04), "179000")
assert_equal(to_string(-1.7e+300), "-1.7e+300")
assert_equal(to_string(-1.7e-300), "-1.7e-300")
assert_equal(to_string(17.5e30l), "1.75e+31")
assert_equal(to_string(1/3.14159e300L), "3.1831e-301")
assert_equal(to_string(1.0 / 12345), "8.10045e-05")
assert_equal(to_string(3e8F), "3e+08")
assert_equal(to_string(-15E-8*3e8), "-45")
assert_equal(to_string(-0.5e+3+20e-01), "-498")