To eliminate the problem you could use bigrat and use fractions.
Compare:
perl -Mbignum -e ' printf "%20.17f\n", 20.1;' 20.10000000000000142 perl -Mbigrat -e ' printf "%20.17f\n", 20.1;' 20.10000000000000142 perl -Mbigrat -e ' printf "%20.17f\n", 20+1/10; 20.00000000000000000
In reply to Re^2: floating point addition
by morgon
in thread floating point addition
by kresike
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |