% and floats
I never knew there was a problem with using % with floats. However, I just got this error:
I'd like to constrain the float variable to values between 0 and 2PI (radian measurements, and I'd prefer not to lose precision as the value continues to increase) Is there a way to do it without using while loops - a modulus for floats? I could code it easily enough like that, but it seems ugly and slow.
error C2296: '%' : illegal, left operand has type 'float'
I donīt think so.
And I think that is impossible to have a "mod" to float because float division does not have rest.
There's the fmod function. That'll do what you're asking with out any unneeded performance hit.