On Thu, 7 Aug 2003, Benjamin Goldberg wrote: > > Shouldn't the get_number() method use string_from_num, instead of > calling sprintf/snprintf?
I've just tried this, and a number of tests break. There seem to be two main reasons. Firstly, some tests were assuming that stringified PerlNums would always include six digits following the decimal point, including trailing zeros; in other words, 1.1 would be printed as 1.100000 It seems unwise to rely on this being the case (particularly since the tests in question are generally of arithmetic ops, and not of the sprintf system), so I've tweaked the tests slightly to avoid this particular issue. The second problem is that string_to_num doesn't seem to create strings with sufficient precision in some cases. For instance: new P0, .PerlNum set P0, 1234.5678911 print P0 print "\n" end prints: 1234.57 while the corresponding version using FLOATs prints: 1234.567891 NB The problem does seem to arise at the stage where the string is created for printing, since: new P0, .PerlNum set P0, 1234.5678911 sub P0, 1234 print P0 print "\n" end prints: 0.567891 Anyway, the list of tests that fail is: Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------- t/op/arithmetics.t 2 512 40 2 5.00% 25 29 t/pmc/perlstring.t 1 256 17 1 5.88% 1 t/pmc/pmc.t 7 1792 89 7 7.87% 31-32 48-49 85-87 20 subtests skipped. Simon