Answered
addition problem - is actionscript/flash able to calculate correctly????
Hi,
I am adding two float numbers that return an incorrect result. Here is what I am doing...
var simpleMath:Number = Number(parseFloat("110.50")) - Number(parseFloat("107.10"));
alert("Simple Math=" + String(simpleMath));
The result I get is... Simple Math=3.40000000000001
How is this possible?
I have tried...
var simpleMath:Number = Number(110.50) - Number(107.10);
var simpleMath:Number = 110.50 - 07.10;
var numba:Number = 110.50;
var numbb:Number = 107.10;
var simpleMath:Number = numba - numbb;
They all give the same result...
When I try this:
Final_Payment.text = Number(Total_Payment_Due.text) - ((Number(Payment_Count.text) - 1) * Number(Payment_Amount.text));
Where Total_Payment_Due.text = 110.50 and Payment_Count.text = 36 and Payment_Amount.text = 3.06
I get this result: 3.39999999999999...
Can someone please tell me what I am going wrong. Or is there problem with actionscript/flash...
I am using Cold Fusion 7.0.1 and actionscript inside a Flash Form savecontent variable.
This is driving me crazy...
Also, is there a round function for floats? I know about the Math.round() but it only works on integers.
Any help would be extreemly appreciated!
Thanks in advance,
Ed
