Files
wren/test/core/number/fraction.wren
T
Bob Nystrom 64eccdd9be Reorganize tests and benchmark scripts.
Mainly to get rid of one top level directory. But this will
also be useful when there are tests of the embedding API.
2015-03-14 12:45:56 -07:00

20 lines
896 B
Plaintext

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