So I heard you can't use the modulus operator with floats. You need to use fmod. So my question is, why didn't they just make the operator do that? Is there some technical reason behind it or something?
This is a discussion on fmod % within the C Programming forums, part of the General Programming Boards category; So I heard you can't use the modulus operator with floats. You need to use fmod. So my question is, ...
So I heard you can't use the modulus operator with floats. You need to use fmod. So my question is, why didn't they just make the operator do that? Is there some technical reason behind it or something?
Perhaps because mod is usually the remainder after division, but in floating point there never is any remainder with division.
Or maybe you'd just have to ask the language inventors.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"