Question

I found that in Actionscript2, if Math.round does work when I do Math.round(7.5) and it gives me 8, but if I have an math expression which has a value 7.5 and apply Math.round to it, like: Math.round(value * 10) (here value is 0.75), instead of giving me 8, it gives me 7

Anyone know what exactly happened to it?

Thanks in advance!

Was it helpful?

Solution 2

used the function on this page: http://ryanbosinger.com/blog/2008/flashactionscript-innaccurate-math-results/ the issue got resolved

OTHER TIPS

function test(val:Number):int {
  return Util.print(Math.round(val * 10));;
}   
test(.75);   //prints 8

Perhaps provide your code?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top