Pregunta

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!

¿Fue útil?

Solución 2

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

Otros consejos

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

Perhaps provide your code?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top