This content has been marked as final. Show 4 replies
Yeah, this is a known issue with AS, due to the way computers store data.
Google it and you'll find explanations and work arounds.
I have just came over
Sadly there is no solution. Does it mean I will need to make my own functions for floating point operation? I only need 3 decimal point precision (x.xxx).
There is no solution because its not really a bug and there is no possible
'fix' because of the nature of numbers in computers.
However, you can round your answers before you display them and instead of
checking for equality for non-whole numbers, always check for a range (ie +
or - a little bit)
I had a similar problem using logarithms in Flex 1.5 and AS 2.0. I say similar because when I traced my result (var answer) I would get "0" but if I tested the logic (answer == 0 ? ) I would get "false". Long story short, I cast my result as a String and then back into a Number. Number(String(answer)) == 0 ? gave me true. Don't know if that will help you or not, but thought I would just throw it out there.