in reply to simple arithmetic creates rounding errors
This is simply rounding to an arbitrary 9 decimal points. Obviously you need to look at the formulas you're working with but this should serve in a lot of cases.my $frac = sprintf("%.9g", ($num - $int) );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: simple arithmetic creates rounding errors
by Anonymous Monk on Jan 13, 2006 at 11:33 UTC |