in reply to Problem with numbers..
It's a standard problem when dealing with real numbers on a computer. Most real numbers can't be represented accurately using the binary representations used in computers. You'll therefore just get an approximation (as your example shows).
There are two options for dealing with it. Either stick with real numbers and make sure that everything is rounded to the correct number of decimal places before displaying it to the user or use integer arithmatic whenever possible.
See also perlfaq4.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|