in reply to Re: Re: floating points and sprintf
in thread floating points and sprintf

No, the real value is 147.199999999999990, since .2 cannot be represented exactly in a floating-point variable. Multiplying by 100 will not make it magically go back to what you wanted it to be, since the roundoff already occured. 14719.999999... truncated to an int is 14719, exactly what it said it does. This is not a bug, this is a typical floating-point gotcha.

You probably want to correctly round rather than truncating. E.g. $intval= int(0.5 + $floatval);.

—John