[2232] in java-interest

home help back first fref pref prev next nref lref last post

modulus on floats?

daemon@ATHENA.MIT.EDU (Eric Barna)
Wed Sep 27 07:46:09 1995

From: Eric Barna <ebarna@teachersoft.com>
To: java-interest@java.sun.com
Date: Tue, 26 Sep 1995 15:58:29 ()


I've been playing with arithmetic (I'm one of the unwashed hordes
writing books).

The JDK Change Notes say "the meaning of floating point % got clarified."


To what?


The alpha spec says that a % b on floats is equivalent to:

a - ((int)(a / b) * b)

However, that's not what a % b is currently behaving like, and I'm getting
really bizarre results.  12.5 % 7.5, for example, is now -1.5.  Huh?

What's the new formula for floating-point modulus?


Laura



-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com
..

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post