Why does MMF not subtract/add to zero? (read post)
Hi,
I made a very simple program in MMF which is causing me the most of problems, my goal is simply do this: I want an object to rotate using decimal values, I want each rotation to be say 0.01 pixels I know this seems impossible, but I thought sub-pixel movement was feasible? I used ALT VAL*0.01 and it adds and subtracts fine, but the problem is when it gets to zero the angle is some strange number (try this using an object add a decimal alt. val to it and then subtract that same value and the angle never seems to become zero). I can post an example if need be. Also please try to make the increment low, preferably 0.01 or lower.
-Thanks, Variant
Re: Why does MMF not subtract/add to zero? (read post)
http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
Re: Why does MMF not subtract/add to zero? (read post)
You could use an alterable value to hold the angle * 100, and then set the real angle to the alterable value / 100.0 when you change it. That way you're never reading a floating point number.
Obviously you'd add 1 instead of 0.01 in this case.
Re: Why does MMF not subtract/add to zero? (read post)
I just figured that out before you posted it!!! But yes, that appears to work wonderfully! It is a little strange though why the other way didn't work... Thanks for the help anyway though! It is greatly appreciated! :)
-Thanks, Variant