Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: krysber on December 10, 2015, 11:31:15 PM
-
I have a loop that repeats thirty two times subtracting .01 from a float variable. The problem is that when the variable is 2.72, I end up with 2.080001 after deleting .01 thirty two times. This happens at different values where I end up with odd numbers like -4.649992 and such. Is there a better way to do this math?
-
Sound like a rounding issue to me. Have you tried doin it with bigger numbers? Instead of subtracting constantly 0.01 you could multiply your floats with 100 before the math operations. if required, divide by 100 at the end.
-
I tried with the same effect. I solved it by using integers to do the math then converting to float.