http://qs321.pair.com?node_id=11123148


in reply to Re^3: int() function
in thread int() function

> if the stringification provided an extra 2 decimal digits

How this? There are only 2-3 bits left and 2**3 < 10, so no way to get a 16th decimal out of a double.

I know it's confusing. But if you stuff a number with more than 15 decimals into a double you'll have loss anyway. And I doubt it's better in JS or python.

> "cmp_ok(0.14, '==', 1.4 / 10

Well, but on the other hand eq should work because of the magic.

IMHO most people understand rounding errors, the point of confusion is that exact decimal fractions are not always exact binarie floats.

Probably we should have a shortcut for something like printf "%.18f" to facilitate diagnosis.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery