A bug in mod operations of 64bit integer

SHUDOH Kazuyuki shudoh at muraoka.info.waseda.ac.jp
Thu Nov 5 06:20:08 PST 1998


Did anyone notice a behavior which differs from JDK for SunOS 5?
This maybe a bug of FreeBSD port of JDK.

=====
class inttest {
    static public void main(String s[]) {
	long a, b;

	a = -1111123;
	b = -1123;

	System.out.println(a % b);
	System.out.println(b % a);

	a = 11123;
	b = -123;

	System.out.println(a % b);
	System.out.println(b % a);

	a = -1111123;
	b = 1123;

	System.out.println(a % b);
	System.out.println(b % a);
    }
}
=====

We'll see on SunOS 5 and Linux:
-476
-1123
53
-123
-476
1123

But on FreeBSD and JDK 1.1.6 V98-9-23:
476
1123
-53
-123
-476
-1123

Kazuyuki SHUDO				Happy Hacking!
  Muraoka Lab., Grad. School of Sci. & Eng., Waseda Univ.

To Unsubscribe: send mail to majordomo at FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message

----- End of forwarded message from SHUDOH Kazuyuki -----
___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com


More information about the kaffe mailing list