[armedbear-cvs] r12535 - trunk/abcl/src/org/armedbear/lisp
Erik Huelsmann
ehuelsmann at common-lisp.net
Sun Mar 14 19:17:39 UTC 2010
Author: ehuelsmann
Date: Sun Mar 14 15:17:37 2010
New Revision: 12535
Log:
Fix returned values from SingleFloat.getInstance() and
DoubleFloat.getInstance() for -0.0; -0.0 == 0.0.
Patch by: Douglas Miles (dmiles at users dot sf dot net)
Modified:
trunk/abcl/src/org/armedbear/lisp/DoubleFloat.java
trunk/abcl/src/org/armedbear/lisp/SingleFloat.java
Modified: trunk/abcl/src/org/armedbear/lisp/DoubleFloat.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/DoubleFloat.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/DoubleFloat.java Sun Mar 14 15:17:37 2010
@@ -56,10 +56,13 @@
}
public static DoubleFloat getInstance(double d) {
- if (d == 0)
- return ZERO;
- else if (d == -0.0d )
- return MINUS_ZERO;
+ if (d == 0) {
+ long bits = Double.doubleToRawLongBits(d);
+ if (bits < 0)
+ return MINUS_ZERO;
+ else
+ return ZERO;
+ }
else if (d == 1)
return ONE;
else if (d == -1)
Modified: trunk/abcl/src/org/armedbear/lisp/SingleFloat.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/SingleFloat.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/SingleFloat.java Sun Mar 14 15:17:37 2010
@@ -56,10 +56,13 @@
}
public static SingleFloat getInstance(float f) {
- if (f == 0)
- return ZERO;
- else if (f == -0.0f )
- return MINUS_ZERO;
+ if (f == 0) {
+ int bits = Float.floatToRawIntBits(f);
+ if (bits < 0)
+ return MINUS_ZERO;
+ else
+ return ZERO;
+ }
else if (f == 1)
return ONE;
else if (f == -1)
More information about the armedbear-cvs
mailing list