-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

        Hi,

as Sven pointed out here:
http://developer.classpath.org/pipermail/classpath-patches/2006-August/003678.html
the methods i recently implemented must return their argument if it is
NaN, instead of returning the constant Double.NaN.

I took the liberty of committing this without asking for approval, since
it's in response to a comment from Sven, trivial and backed by mauve
tests. Please start yelling if I leaned too far out of the window.

        Thanks,
                Carsten

2006-08-03  Carsten Neumann  <[EMAIL PROTECTED]>

        * StrictMath.java (cbrt): Return argument if it is a NaN.
        (cosh): Likewise.
        (expm1): Likewise.
        (sinh): Likewise.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE0kjPd4NEZjs4PvgRAloyAJ0WwV45gJtH2KCUb+vx/xcq2WXa3QCgxC08
VFC8KJvLhuly3oeZYP8TG3w=
=6v1m
-----END PGP SIGNATURE-----
Index: java/lang/StrictMath.java
===================================================================
RCS file: /sources/classpath/classpath/java/lang/StrictMath.java,v
retrieving revision 1.14
diff -u -r1.14 StrictMath.java
--- java/lang/StrictMath.java	3 Aug 2006 18:42:11 -0000	1.14
+++ java/lang/StrictMath.java	3 Aug 2006 18:47:24 -0000
@@ -673,7 +673,7 @@
 
     // handle special cases
     if (x != x)
-      return Double.NaN;
+      return x;
     if (x == Double.POSITIVE_INFINITY)
       return Double.POSITIVE_INFINITY;
     if (x == Double.NEGATIVE_INFINITY)
@@ -763,7 +763,7 @@
 
     // handle special cases
     if (x != x)
-      return Double.NaN;
+      return x;
     if (x == Double.POSITIVE_INFINITY)
       return Double.POSITIVE_INFINITY;
     if (x == Double.NEGATIVE_INFINITY)
@@ -947,7 +947,7 @@
 
     // handle the special cases
     if (x != x)
-      return Double.NaN;
+      return x;
     if (x == Double.POSITIVE_INFINITY)
       return Double.POSITIVE_INFINITY;
     if (x == Double.NEGATIVE_INFINITY)
@@ -1180,7 +1180,7 @@
 	    if (h_bits >= 0x7ff00000L)
 	      {
 		if (((h_bits & 0x000fffffL) | (l_bits & 0xffffffffL)) != 0)
-		  return Double.NaN;               // exp(NaN) = NaN
+		  return x;                        // exp(NaN) = NaN
 		else
 		  return negative ? -1.0 : x;      // exp({+-inf}) = {+inf, -1}
 	      }

Reply via email to