[kaffe] Bug Report: Mixed Mode Arithmetic
   
    atanu_mohanty@agilent.com
     
    atanu_mohanty@agilent.com
       
    Fri, 14 Jun 2002 10:28:44 -0600
    
    
  
Hi,
  I found the following bug in Kaffe 1.0.6.
Please ignore this if 1.0.7rc1 has fixed it.
Thanks.
Atanu
Description:
Mixed mode arithmetic is not handled properly.
In particular int * double is int, in violation of
JLS 5.6.2 ( Binary numeric promotion ).
---------------------
[mcast@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@pimcast tmp]$ java KBug
2*Math.PI = 6
2.0*Math.PI = 6.2831853071795862
[mcast@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@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@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.
========END=========