質問

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!

役に立ちましたか?

解決 2

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

他のヒント

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

Perhaps provide your code?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top