[kaffe] Bug Report: Math.round() problem

Mr Carrot mr_carrot_73@hotmail.com
Wed Feb 25 09:39:15 2004


This is a multi-part message in MIME format.

------=_NextPart_000_0160_01C3F997.12330FA0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello.

I have found that Math.round() returns a large negative number instead =
of returning the rounded version of the argument.  I am using Kaffe =
version 1.0.7.

Here is a test program that illustrates the problem:
public class HelloWorld
{
  public static void main(String[] args)
  {
    System.out.println("Hello World");
    System.out.print("Math.round(100D) =3D ");
    System.out.println(Math.round(100D));
    System.out.print("Math.floor(100D) =3D ");
    System.out.println(Math.floor(100D));
  }
}

Here is the output from running this program:
$ /usr/local/kaffe/bin/kaffe HelloWorld
Hello World
Math.round(100D) =3D -9223372036854775808
Math.floor(100D) =3D 100.0
$=20

Here is the output when I use "Sun Java 1.3.0_02" to run it:
$ java HelloWorld
Hello World
Math.round(100D) =3D 100
Math.floor(100D) =3D 100.0
$=20

------=_NextPart_000_0160_01C3F997.12330FA0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have found that Math.round() returns =
a large=20
negative number instead of returning the rounded version of the =
argument.&nbsp;=20
</FONT><FONT face=3DArial size=3D2>I am using Kaffe version =
1.0.7.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Here is a test program that illustrates =
the=20
problem:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>public class HelloWorld<BR>{<BR>&nbsp; =
public=20
static void main(String[] args)<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp;=20
System.out.println("Hello World");</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;=20
System.out.print("Math.round(100D) =3D ");<BR>&nbsp;&nbsp;&nbsp;=20
System.out.println(Math.round(100D));</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;=20
System.out.print("Math.floor(100D) =3D ");<BR>&nbsp;&nbsp;&nbsp;=20
System.out.println(Math.floor(100D));<BR>&nbsp; }<BR>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Here is the output from running this=20
program:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>$ /usr/local/kaffe/bin/kaffe =
HelloWorld<BR>Hello=20
World<BR>Math.round(100D) =3D -9223372036854775808<BR>Math.floor(100D) =
=3D=20
100.0<BR>$ </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Here is the output when I use "Sun Java =
1.3.0_02"=20
to run it:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>$ java HelloWorld<BR>Hello=20
World<BR>Math.round(100D) =3D 100<BR>Math.floor(100D) =3D 100.0<BR>$ =
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0160_01C3F997.12330FA0--