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...
You are right. It's very not funny.
Here's one solution that might be useful to you...
correctThis = function(thisNumber:Number,thesePlaces:Number):Number{
var temp:Number = Math.pow(10,thesePlaces);
return Math.round(thisNumber * temp) / temp;
}
var a:Number = 171.9;
var b:Number = 172.2;
var c:Number;
trace(correctThis(b - a,2));
...0.3
Cheers
David
_______________________________________________
[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