[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] Patch: fix Float/DoubleBuffer.compareTo in the presence of
From: |
Anthony Green |
Subject: |
[cp-patches] Patch: fix Float/DoubleBuffer.compareTo in the presence of NaN |
Date: |
Tue, 06 Dec 2005 03:05:43 -0800 |
This patch makes sure FloatBuffer and DoubleBuffer objects compare
properly when they contain NaN values. I've already checked in Mauve
tests cases. Ok to commit?
AG
2005-12-06 Anthony Green <address@hidden>
* java/nio/DoubleBuffer.java (compareTo): Handle NaN values within
the buffer.
* java/nio/FloatBuffer.java (compareTo): Ditto.
Index: java/nio/FloatBuffer.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/nio/FloatBuffer.java,v
retrieving revision 1.20
diff -u -r1.20 FloatBuffer.java
--- java/nio/FloatBuffer.java 2 Jul 2005 20:32:39 -0000 1.20
+++ java/nio/FloatBuffer.java 6 Dec 2005 11:02:39 -0000
@@ -303,7 +303,11 @@
if (a < b)
return -1;
-
+
+ // Handle the case where a and b are NaN.
+ if ((a != a) && (b != b))
+ continue;
+
return 1;
}
Index: java/nio/DoubleBuffer.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/nio/DoubleBuffer.java,v
retrieving revision 1.20
diff -u -r1.20 DoubleBuffer.java
--- java/nio/DoubleBuffer.java 2 Jul 2005 20:32:39 -0000 1.20
+++ java/nio/DoubleBuffer.java 6 Dec 2005 11:02:39 -0000
@@ -304,6 +304,10 @@
if (a < b)
return -1;
+ // Handle the case where a and b are NaN.
+ if ((a != a) && (b != b))
+ continue;
+
return 1;
}
- [cp-patches] Patch: fix Float/DoubleBuffer.compareTo in the presence of NaN,
Anthony Green <=