Commit c342f126 by Tom Tromey

[multiple changes]

2002-01-15  Tom Tromey  <tromey@redhat.com>

	* java/lang/Float.java (equals): Preserve old code.
	* java/lang/Double.java (equals): Preserve old code.

2002-01-15  Eric Blake  <ebb9@email.byu.edu>

	* java/lang/Double.java (equals, compare): Fix 0.0 vs. -0.0 math.
	* java/lang/Float.java (equals, compare): Ditto.

From-SVN: r48895
parent 30c74616
2002-01-15 Tom Tromey <tromey@redhat.com>
* java/lang/Float.java (equals): Preserve old code.
* java/lang/Double.java (equals): Preserve old code.
2002-01-15 Eric Blake <ebb9@email.byu.edu>
* java/lang/Double.java (equals, compare): Fix 0.0 vs. -0.0 math.
* java/lang/Float.java (equals, compare): Ditto.
2002-01-13 Mark Wielaard <mark@klomp.org>
* java/net/DatagramSocket.java (getReceiveBufferSize): new 1.2 method.
......
/* Double.java -- object wrapper for double primitive
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -163,9 +163,12 @@ public final class Double extends Number implements Comparable
if (!(obj instanceof Double))
return false;
Double d = (Double) obj;
double d = ((Double) obj).value;
return doubleToLongBits (value) == doubleToLongBits (d.doubleValue ());
// GCJ LOCAL: this implementation is probably faster than
// Classpath's, especially once we inline doubleToLongBits.
return doubleToLongBits (value) == doubleToLongBits (d);
// END GCJ LOCAL
}
/**
......@@ -334,10 +337,9 @@ public final class Double extends Number implements Comparable
return isNaN (y) ? 0 : 1;
if (isNaN (y))
return -1;
if (x == 0.0d && y == -0.0d)
return 1;
if (x == -0.0d && y == 0.0d)
return -1;
// recall that 0.0 == -0.0, so we convert to infinites and try again
if (x == 0 && y == 0)
return (int) (1 / x - 1 / y);
if (x == y)
return 0;
......
/* java.lang.Float
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -232,9 +232,12 @@ public final class Float extends Number implements Comparable
if (!(obj instanceof Float))
return false;
Float f = (Float) obj;
float f = ((Float) obj).value;
return floatToIntBits (value) == floatToIntBits (f.floatValue ());
// GCJ LOCAL: this implementation is probably faster than
// Classpath's, especially once we inline floatToIntBits.
return floatToIntBits (value) == floatToIntBits (f);
// END GCJ LOCAL
}
/**
......@@ -484,10 +487,9 @@ public final class Float extends Number implements Comparable
return isNaN (y) ? 0 : 1;
if (isNaN (y))
return -1;
if (x == 0.0 && y == -0.0)
return 1;
if (x == -0.0 && y == 0.0)
return -1;
// recall that 0.0 == -0.0, so we convert to infinities and try again
if (x == 0 && y == 0)
return (int) (1 / x - 1 / y);
if (x == y)
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment