you most likely have a calculation resulting in a fraction of 0.12 after the point which is 3/25 and 25=5^2 can't be coded without loss in a binary system.
Additionally Perl does some DWIM magic to hide minor errors, such that a printed 0.12 is not necessarily == 0.12 .
solution:
To calculate dollars "accurately" with 2 decimal places, you need
to calculate right from the beginning in cents as integers!
So just calculate with integers in the desired accuracy and shift the decimal point afterwards!
from Humans have too many fingers
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
In reply to Re: subtraction issue
by LanX
in thread subtraction issue
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |