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.

posted 1:03 pm  

0 comments:

Post a Comment