xrmb sprintf is the way to go, but if you're feeling lazy; just add "use bigrat;" (aka. big rational, cpan: bigrat) to the top of your proggie. It is not optimal (neither is bignum), but it does increases precision.
Example: imprecise.plOutput:use bigrat; print int(4.39 * 100) . "\n"; my $a = 4.39, $b = 100; print int ($a*$b) ."\n"; my $ans = $a*$b; print $a*$b ."\n"; print int ( $ans ) ."\n";
perl imprecise.pl 439 439 439 439
In reply to Re: shocking imprecision
by rgiskard
in thread shocking imprecision
by xrmb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |