in reply to Re^2: perl subtraction
in thread perl subtraction
What I understand now is that the internal base 2 representation is not likely to cause any problems if I am dealing with only integers.
Yes, as long as they're not too large. If you keep the numbers small than ±9,007,199,254,740,992, you'll be ok.
>perl -e"printf qq{%.0f\n}, 9007199254740992 + 3" 9007199254740996 even? how odd!
Have fun calculating tax without using decimals, though. What you want to do then is perform rounding:
# If working with cents $tax_amount = sprintf('%.0f', $amount * $tax_rate);
|
|---|