Hi,
I noticed odd trace that wonder whether someone can explain.
I’ve got the following code in an ENTER_FRAME event. It’s used to move an object.
_vx +=0.2;
_vy +=0.2;
x+=_vx;
y+=_vy;
trace("_vx: " + _vx);
trace("x: " + x);
trace("----------");
The trace for the first 5 frames looks like this:
_vx: 0
x: 275
----------
_vx: 0.2
x: 275.2
----------
_vx: 0.4
x: 275.55
----------
_vx: 0.6000000000000001
x: 276.15
----------
_vx: 0.8
x: 276.95
Obviously, 275.2 + 0.4 doesn’t equal 275.55.
Does anyone know the reason for this?
Thanks!
Dandylion13