java modulus for floating point numbers
Thursday, October 09, 2008
The java modulus (or remainder) operator (%) truncates instead of rounds with floating point numbers (ie float, double), so the solution is to use Math.IEEEremainder instead. It's fine to use % for ints.
0 comments:
Subscribe to:
Post Comments (Atom)