0.1*0.1=0.010000000000002 (error)

Yeah, and I’ve only noticed it on the Canvas. I’m setting a sprite’s y position to 0 and another sprite’s y position to 75. The “app variable bar spacing” is set to 75 at initialization.

When I check the value of bar 1’s y position using a canvas label, it gives me that crazy 10.9… number. And it’s clearly not positioned 75 pixels above bar 2. It’s actually about 64 pixels away. So strange. None of it makes much sense to me!

Edit: the problem seems to be caused when there is a variable, not necessarily by the math itself. I tried setting a sprite’s y value to 100 and it worked. I then tried initializing a variable to 100 and setting the same sprite’s y value to the variable and… it was off by about 50 pixels.

3 Likes