[kaffe] Bug Report: Mixed Mode Arithmetic

atanu_mohanty at agilent.com atanu_mohanty at agilent.com
Fri Jun 14 09:28:44 PDT 2002

  I found the following bug in Kaffe 1.0.6.
Please ignore this if 1.0.7rc1 has fixed it.


Mixed mode arithmetic is not handled properly.
In particular int * double is int, in violation of
JLS 5.6.2 ( Binary numeric promotion ).

[mcast at pimcast tmp]$ java -version
Kaffe Virtual Machine
Copyright (c) 1996-2000
Transvirtual Technologies, Inc.  All rights reserved
Engine: Just-in-time v3   Version: 1.0.6   Java Version: 1.1
[mcast at pimcast tmp]$ java KBug
2*Math.PI = 6
2.0*Math.PI = 6.2831853071795862
[mcast at pimcast tmp]$ cat KBug.java 

public class KBug
  public static void main( String args[] )
    System.out.println( "2*Math.PI = " + (2*Math.PI) );
    System.out.println( "2.0*Math.PI = " + (2.0*Math.PI) );

[mcast at pimcast tmp]$ uname -a
Linux pimcast 2.4.7-10 #1 Thu Sep 6 17:21:28 EDT 2001 i586 unknown


OS I am using: RHL7.2

JDK on another machine prints the following...

[amohanty at wstcrobot61 glyph]$ java KBug
2*Math.PI = 6.28319
2.0*Math.PI = 6.28319

Note: This is not simply a formatting bug. It caused
a method for drawing an arc through three given points
to show incomplete arcs. The fix was to replace 2*Math.PI
by 2.0*Math.PI everywhere.


More information about the kaffe mailing list