in reply to losing precision reading numbers from file
Perl uses doubles for floating point numbers. Doubles have 52 bits of precision, which translates to roughly 15 (log10 252) digits of precision. Therefore, an error on the 16th significant digit shouldn't be unexpected when converting the string to a number. Remember, to convert 0.4079... from a string to a number, the computer has to do something like 4*10-1 + 7*10-3 + 9*10-4 + 6*10-5 + ... and some numbers (such as 0.4, IIRC) are periodic numbers in binary.
|
|---|