Branch: Tag:

2009-08-05

2009-08-05 09:45:33 by Martin Stjernholm <mast@lysator.liu.se>

Test that casting floats to strings don't include rounding errors in
the printed value. (We might not get away with these tests if fprintf
%g implementations vary too much..)

Rev: src/testsuite.in:1.877

1:   START_MARKER - test_true([["$Id: testsuite.in,v 1.876 2009/06/30 21:39:51 mast Exp $"]]); + test_true([["$Id: testsuite.in,v 1.877 2009/08/05 09:45:33 mast Exp $"]]);      // This triggered a bug only if run sufficiently early.   test_compile_any([[#pike 7.2]])
8242:    has_value ((string)-1e-100, "e")]])   test_true([[has_value ((string)124354236143512312334562453624.1, ".") ||    has_value ((string)124354236143512312334562453624.1, "e")]]) + test_eq([[(string) 0.8]], [["0.8"]]) + cond([[Float.DIGITS_10 >= 6]], [[ // Usual size with 32 bit IEEE floats. +  test_eq([[(string) 0.811113]], [["0.811113"]]) +  test_eq([[(string) 0.811114]], [["0.811114"]]) +  test_eq([[(string) 0.811113e20]], [["8.11113e+19"]]) +  test_eq([[(string) 0.811114e20]], [["8.11114e+19"]]) + ]]) + cond([[Float.DIGITS_10 >= 15]], [[ // Usual size with 64 bit IEEE floats. +  test_eq([[(string) 0.811111111111113]], [["0.811111111111113"]]) +  test_eq([[(string) 0.811111111111114]], [["0.811111111111114"]]) +  test_eq([[(string) 0.811111111111113e20]], [["8.11111111111113e+19"]]) +  test_eq([[(string) 0.811111111111114e20]], [["8.11111111111114e+19"]]) + ]])   test_do(return (string)1e308)   test_do(return (string)1e200)   test_do(return (string)1e-200)