[2319] in java-interest
Re: modulus on floats?
daemon@ATHENA.MIT.EDU (Richard Tuck)
Fri Sep 29 08:46:48 1995
Date: Wed, 27 Sep 1995 15:19:02 +0800
From: rt@scndprsn.eng.sun.com (Richard Tuck)
To: java-interest@java.Eng.Sun.COM, ebarna@teachersoft.com
a % b on floats is now the same as the IEEE remainder operation
(which is also the SVID remainder() ). It goes something like
this:
a) compute n = Math.rint( a/b ) that is, the nearest
whole number to a/b, with a tie going to an even number
b) then r = a - n*b is the remainder.
For example, this definition yields -2.5 for 12.5 % 7.5, because
12.5/7.5 gives 5/3, which rounds to 2, and 12.5 - 2*(7.5) is
-2.5
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com