2006
01.06

cos(90)

szóval ez szánalmas azért valahol :
trace(Math.cos(Math.PI/2))

minden jóérzésű ember rávágná hogy 0, de a pc az nem.
szerinte 6.12303176911189e-17.
oké hogy ez kiba kicsi szám de akkor sem 0. lásd ez alábbi false:
trace(Math.cos(Math.PI/2)==0);

flash helpben írja hogy mindez azért van mert hogy :

The cosine of a 90 degree angle is zero, but because of the inherent inaccuracy of decimal calculations using binary numbers, Flash Player will report a number extremely close to, but not exactly equal to, zero.

No Comment.

Add Your Comment