floating number bug on CF + MySQL DECIMAL
Everyone knows, there is a problem which is conversion My SQL DECIMAL into CF number. I checked it with CF line debugging. There is very very interesting behavior.
There is "9.95" decimal in MySQL. When I got the value on AIR/Flex through LCDS, it was transformed into "9.94". Who stole a cent??
I believe type conversion of Java to AS is very precise. So I guessed the criminal must be CF. Consequentially yes it is.
When I looked it at first time, it was "9.95" in variable view of CF debugging. But I was convinced "this '9.95' must be an illusion". To ensure that it was "9.95", I tried this.
You know waht? How much is "num"? It's "9.94"! I though "WHAT!!"
So I checked this step by step with CF debugger. Then it happened.
I stepped over at "num = num * 100;"

Then num was transformed into "994.9999999999999"

Oh, Give me a break!! What the hell is this?? But I have to correct this. So I did like this.
Now I got "9.95"!!
Wait a minute. Why am I taking time for such thing?
There is "9.95" decimal in MySQL. When I got the value on AIR/Flex through LCDS, it was transformed into "9.94". Who stole a cent??
I believe type conversion of Java to AS is very precise. So I guessed the criminal must be CF. Consequentially yes it is.
When I looked it at first time, it was "9.95" in variable view of CF debugging. But I was convinced "this '9.95' must be an illusion". To ensure that it was "9.95", I tried this.
You know waht? How much is "num"? It's "9.94"! I though "WHAT!!"
So I checked this step by step with CF debugger. Then it happened.
I stepped over at "num = num * 100;"

Then num was transformed into "994.9999999999999"

Oh, Give me a break!! What the hell is this?? But I have to correct this. So I did like this.
Now I got "9.95"!!
Wait a minute. Why am I taking time for such thing?