fix: correct fraction and truncate test expectations for negative zero and large values

- Update fraction.wren test to cover edge cases for negative zero, small fractions, and large mantissa approximations
- Fix truncate.wren expected output for negative zero cases from 0 to -0
- Add truncate tests for large 32-bit representation values with approximation notes
This commit is contained in:
Marco Lizza
2015-03-05 10:24:54 +00:00
parent ea20c2d086
commit e70d6411fb
2 changed files with 26 additions and 2 deletions
+19
View File
@@ -0,0 +1,19 @@
IO.print(123.fraction) // expect: 0
IO.print((-123).fraction) // expect: -0
IO.print(0.fraction) // expect: 0
IO.print((-0).fraction) // expect: -0
IO.print(0.123.fraction) // expect: 0.123
IO.print(12.3.fraction) // expect: 0.3
IO.print((-0.123).fraction) // expect: -0.123
IO.print((-12.3).fraction) // expect: -0.3
// Using 32-bit representation, a longer mantissa will lead to
// approximation.
IO.print((1.23456789012345).fraction) // expect: 0.23456789012345
IO.print((-1.23456789012345).fraction) // expect: -0.23456789012345
IO.print((0.000000000000000000000000000000000000000001).fraction) // expect: 1e-42
IO.print((-0.000000000000000000000000000000000000000001).fraction) // expect: -1e-42
IO.print((1.000000000000000000000000000000000000000001).fraction) // expect: 0
IO.print((-1.000000000000000000000000000000000000000001).fraction) // expect: -0