Hi everyone! I have a weird behavior which I don't understand and I'm hoping someone can help.
Hopefully I'm just doing something stupid.
I have an expression which doesn't seem to be evaluating correctly, which leads me to think I've written the expression wrong or something, but I can't see how.
The expression:
TickCount % (32/speed)
Or in words, the remainder of TickCount divided by (the result of 32 divided by the speed).
Where TickCount is the variable representing the current tick number, and speed is a variable used in a game I am making.
When that equals 0, I want to do a thing.
I have a specific case where that expression should be evaluating to zero, but is not.
Example:
TickCount = 416
speed = 5
so:
416 % (32/5) = 0
Unless I'm crazy, that is true, it evaluates to zero, but my program isn't doing it's thing.
So, I had it also output the result of that expression to a global variable every tick I can monitor in debug, and it claims to be evaluating to 5.399999999999977 at tick 416 with speed 5.
I am baffled by this. Any help would be appreciated! It's a bit of a pain for me to post the actual project for people to poke around in, so I'm hoping the answer is obvious from the above, but if not, let me know and I can try to find a way to share the project.