Re: [cp-patches] Patch: fix Float/DoubleBuffer.compareTo in the presence of NaN

2005-12-11 Thread Mark Wielaard
Hi Anthony,

On Tue, 2005-12-06 at 18:50 -0800, Anthony Green wrote:
  Does it do the right thing if a is NaN and b is not?  Or vice versa?
  If so, this is ok.
 
 Yes, definitely.  Although I have what is probably an even simpler patch
 now.  I'll commit the following later tomorrow unless there are
 objections.

No objections. But you seem to have forgotten to actually commit this
change.

Cheers,

Mark


signature.asc
Description: This is a digitally signed message part
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: fix Float/DoubleBuffer.compareTo in the presence of NaN

2005-12-06 Thread Anthony Green
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  [EMAIL PROTECTED]

* 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 -   1.20
+++ java/nio/FloatBuffer.java   6 Dec 2005 11:02:39 -
@@ -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 -   1.20
+++ java/nio/DoubleBuffer.java  6 Dec 2005 11:02:39 -
@@ -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;
   }
   




___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] Patch: fix Float/DoubleBuffer.compareTo in the presence of NaN

2005-12-06 Thread Tom Tromey
 Anthony == Anthony Green [EMAIL PROTECTED] writes:

Anthony This patch makes sure FloatBuffer and DoubleBuffer objects compare
Anthony properly when they contain NaN values.  I've already checked in Mauve
Anthony tests cases.  Ok to commit?

Does it do the right thing if a is NaN and b is not?  Or vice versa?
If so, this is ok.

Tom


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] Patch: fix Float/DoubleBuffer.compareTo in the presence of NaN

2005-12-06 Thread Anthony Green
On Tue, 2005-12-06 at 11:12 -0700, Tom Tromey wrote:
  Anthony == Anthony Green [EMAIL PROTECTED] writes:
 
 Anthony This patch makes sure FloatBuffer and DoubleBuffer objects compare
 Anthony properly when they contain NaN values.  I've already checked in Mauve
 Anthony tests cases.  Ok to commit?
 
 Does it do the right thing if a is NaN and b is not?  Or vice versa?
 If so, this is ok.

Yes, definitely.  Although I have what is probably an even simpler patch
now.  I'll commit the following later tomorrow unless there are
objections.


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 -   1.20
+++ java/nio/FloatBuffer.java   7 Dec 2005 02:46:34 -
@@ -303,8 +303,12 @@
   
if (a  b)
  return -1;
-  
-   return 1;
+
+   if (a  b)
+ return 1;
+
+   // Otherwise a and b must both be NaN and we can continue
+   // looping.
   }
   
 return remaining() - other.remaining();


(and similarly for DoubleBuffer.java)





___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches