[2110] in java-interest

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

modulus on floats?

daemon@ATHENA.MIT.EDU (Laura Lemay, Killer of Trees)
Mon Sep 25 17:09:13 1995

Date: Mon, 25 Sep 1995 10:57:20 -0800
To: java-interest@java.sun.com
From: lemay@lne.com (Laura Lemay, Killer of Trees)


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

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