Integer Calculations Yield Floating Point Results

This afternoon, I was running a script on snap.berkeley.edu that moved a sprite an integer number of steps along the x-axis from an integer starting x position, and the result was that, when I did a say of its x position, I got a floating point number, close to the actual value, but off by a few digits in the 12th or 13th decimal place. When I downloaded the program and ran it on my home computer, the results were integers. Tonight, the results are integers on snap.berkeley.edu.

It's a strange world ...

Does the calculation involve division? The quotient of two integers is a real. Technically, since Snap! is implemented in Javascript, it uses JS arithmetic, in which there is no integer data type; it's all reals. If you want guaranteed exact integers, use the Bignums library.

I don't think it could have--what they describe is addition of two integers.

There was a division (of an even number) by 2 earlier in the calculations, but when I added a debugging say of the quotient immediately after that division, it reported an integer result. In any case, how does the exact same program produce different results at different times of the day?

Can you post a link to the project for us to look at please?

You may check "x position" watcher then shrink the stage. Sprite is @(0,0)
Stage (30)
Stage (31)

It works as designed. Sprite movement is relative, and positions are recalculated each time they move. Depending on stage scale, screen offset, and so on, it may lead to rounding errors.

Oh, you forgot to include the phase of the moon in your computation. :~P