I am a bit shocked, too. But yeah, I think you are right, I tried it with the subtraction assignment (-=), too and I have the same return.
The second queer thing is that Macromedia says:

"The following statement subtracts the floating-point number 1.5 from the floating-point number 3.25 [ 3.25 - 1.5 = 1.75 ]"

That is true, flash trace it right!

I am confused,
greets johannes



[EMAIL PROTECTED] schrieb:
Apologies if this is common knowledge, but I've just come across a huge maths 
problem in Flash... as I've mentioned before I'm working on an online trading 
system where real people make or lose real money, sometimes a huge amount of 
it, so this isn't funny...

Here's some simple arithmetic..

var a:Number = 171.9;
var b:Number = 172.2;
var c:Number;
c = b - a;

Now an elementary school kid would probably give the answer 0.3
Unfortunately Flash has other ideas...

trace(c);
0.299999999999983

I'm a bit shocked to be honest. Am I imagining it? I'm aware that AS3 introduces proper integers and floats for arithmetic, but that doesnt address my problem now.
What says the wise Chattyfig community??

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to