By using this site, you agree to our Privacy Policy and our Terms of Use. Close

n is a float, so the suggested method above will not work because you cann't do a modulo operation on a floating point number.

Is there a reason you are using a float?

EDIT: There are other problems. Comparing floats to exact numbers is questionable at best due to imprecision. If you use fmod() you wouldn't be able to compare it to 0.0 reliably. so fmod(n,2)==0, where n is an even number, might return false when it should be true. Instead you'd have to compare it to a small epsilon range which doesn't really support what you were trying to determine in the first place.




If you drop a PS3 right on top of a Wii, it would definitely defeat it. Not so sure about the Xbox360. - mancandy
In the past we played games. In the future we watch games. - Forest-Spirit
11/03/09 Desposit: Mod Bribery (RolStoppable)  vg$ 500.00
06/03/09 Purchase: Moderator Privilege  vg$ -50,000.00

Nordlead Jr. Photo/Video Gallery!!! (Video Added 4/19/10)