Hi, we recently found some oddity when it comes to how perl threats floating point numbers. For example:
>perl -e'print 37.73*100' 3773
while
>perl -e'print int(37.73*100)' 3772
Although I can workaround it using sprintf or use bignum. I don't understand why perl is intelligent enough to print 3773 when not using int but it is not smart enough to do same thing when using it. I know internally the number might be 3272.999999999999999 and so int chops off the decimal part but shouldn't be consistent?
This represent a legal problem for our application we rely heavily in maths for prizing and charges calculation.
In reply to Floating point problems by bluescreen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |