Comment 7 for bug 926558

Revision history for this message
Jindrich Makovicka (makovick-gmail) wrote :

It is obvious why it happens. Some decimal numbers cannot be represented precisely in Double, so when parsed, their FP representation is either slightly smaller or lower. Because the conversion to Long always rounds down, sometimes the last digit changes.

The solution is either 1) using a rounding to nearest integer as proposed in #3, or 2) parse the parts before and after the decimal point as integers and avoid using floating point completely.