For given floating point numbers x
and a
, I would like to compute r
(and n
) such that x = a*n + r
. In C/C++ this function is called fmod
. However I do not see a convenient function in .NET. Math.DivRem is only for integers ...
views:
294answers:
2
+5
A:
I think you can just use %
for floats as well. r = x % a
http://msdn.microsoft.com/en-us/library/0w4e0fzs.aspx
All numeric types have predefined modulus operators.
Andreas Brinck
2010-04-22 11:57:24