about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog20
-rw-r--r--sysdeps/ieee754/dbl-64/e_j0.c6
-rw-r--r--sysdeps/ieee754/dbl-64/e_j1.c4
-rw-r--r--sysdeps/ieee754/dbl-64/e_jn.c6
-rw-r--r--sysdeps/ieee754/flt-32/e_j0f.c6
-rw-r--r--sysdeps/ieee754/flt-32/e_j1f.c4
-rw-r--r--sysdeps/ieee754/flt-32/e_jnf.c4
-rw-r--r--sysdeps/ieee754/ldbl-128/e_j0l.c4
-rw-r--r--sysdeps/ieee754/ldbl-128/e_j1l.c4
-rw-r--r--sysdeps/ieee754/ldbl-128/e_jnl.c4
-rw-r--r--sysdeps/ieee754/ldbl-96/e_j0l.c4
-rw-r--r--sysdeps/ieee754/ldbl-96/e_j1l.c4
-rw-r--r--sysdeps/ieee754/ldbl-96/e_jnl.c6
13 files changed, 48 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 010933d371..1caa6c3194 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
 2003-12-28  Andreas Jaeger  <aj@suse.de>
 
+	* sysdeps/ieee754/dbl-64/e_j0.c (__ieee754_y0): Raise only
+	overflow for 0 as argument. Raise Invalid exception for negative
+	args.
+	* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_yn): Likewise.
+	* sysdeps/ieee754/dbl-64/e_j1.c (__ieee754_y0): Likewise.
+	* sysdeps/ieee754/ldb-128/e_jnl.c (__ieee754_ynl): Likewise.
+	* sysdeps/ieee754/ldb-128/e_j0l.c (__ieee754_y0l): Likewise.
+	* sysdeps/ieee754/ldb-128/e_j1l.c (__ieee754_y1l): Likewise.
+	* sysdeps/ieee754/ldb-96/e_jnl.c (__ieee754_ynl): Likewise.
+	* sysdeps/ieee754/ldb-96/e_j0l.c (__ieee754_y0l): Likewise.
+	* sysdeps/ieee754/ldb-96/e_j1l.c (__ieee754_y1l): Likewise.
+	* sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_ynf): Likewise.
+	* sysdeps/ieee754/flt-32/e_j0f.c (__ieee754_y0f): Likewise.
+	* sysdeps/ieee754/flt-32/e_j1f.c (__ieee754_y1f): Likewise.
+
+	* math/libm-test.inc (yn_test): Expect invalid exception for
+	negative arguments.
+	(y0_test): Likewise.
+	(y1_test): Likewise.
+
 	* sysdeps/ieee754/dbl-64/e_exp.c (__ieee754_exp): Do not raise
 	execptions for exp(NaN).
 
diff --git a/sysdeps/ieee754/dbl-64/e_j0.c b/sysdeps/ieee754/dbl-64/e_j0.c
index 77af5fd18c..302df49d62 100644
--- a/sysdeps/ieee754/dbl-64/e_j0.c
+++ b/sysdeps/ieee754/dbl-64/e_j0.c
@@ -185,10 +185,10 @@ V[]  =  {1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */
 
 	EXTRACT_WORDS(hx,lx,x);
         ix = 0x7fffffff&hx;
-    /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0  */
+    /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0, y0(0) is -inf.  */
 	if(ix>=0x7ff00000) return  one/(x+x*x);
-        if((ix|lx)==0) return -one/zero;
-        if(hx<0) return zero/zero;
+        if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception.  */
+        if(hx<0) return zero/(zero*x);
         if(ix >= 0x40000000) {  /* |x| >= 2.0 */
         /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0))
          * where x0 = x-pi/4
diff --git a/sysdeps/ieee754/dbl-64/e_j1.c b/sysdeps/ieee754/dbl-64/e_j1.c
index 260492ae67..8a3b2ffd19 100644
--- a/sysdeps/ieee754/dbl-64/e_j1.c
+++ b/sysdeps/ieee754/dbl-64/e_j1.c
@@ -190,8 +190,8 @@ static double V0[5] = {
         ix = 0x7fffffff&hx;
     /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
 	if(ix>=0x7ff00000) return  one/(x+x*x);
-        if((ix|lx)==0) return -one/zero;
-        if(hx<0) return zero/zero;
+        if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception.  */;
+        if(hx<0) return zero/(zero*x);
         if(ix >= 0x40000000) {  /* |x| >= 2.0 */
 		__sincos (x, &s, &c);
                 ss = -s-c;
diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c
index 64ba79929d..bf4a13d974 100644
--- a/sysdeps/ieee754/dbl-64/e_jn.c
+++ b/sysdeps/ieee754/dbl-64/e_jn.c
@@ -20,7 +20,7 @@ static char rcsid[] = "$NetBSD: e_jn.c,v 1.9 1995/05/10 20:45:34 jtc Exp $";
  * of order n
  *
  * Special cases:
- *	y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
+ *	y0(0)=y1(0)=yn(n,0) = -inf with overflow signal;
  *	y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
  * Note 2. About jn(n,x), yn(n,x)
  *	For n=0, j0(x) is called,
@@ -236,8 +236,8 @@ static double zero  =  0.00000000000000000000e+00;
 	ix = 0x7fffffff&hx;
     /* if Y(n,NaN) is NaN */
 	if((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000) return x+x;
-	if((ix|lx)==0) return -one/zero;
-	if(hx<0) return zero/zero;
+	if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception.  */;
+	if(hx<0) return zero/(zero*x);
 	sign = 1;
 	if(n<0){
 		n = -n;
diff --git a/sysdeps/ieee754/flt-32/e_j0f.c b/sysdeps/ieee754/flt-32/e_j0f.c
index b3b20524f9..8c499e614e 100644
--- a/sysdeps/ieee754/flt-32/e_j0f.c
+++ b/sysdeps/ieee754/flt-32/e_j0f.c
@@ -131,10 +131,10 @@ v04  =  4.4111031494e-10; /* 0x2ff280c2 */
 
 	GET_FLOAT_WORD(hx,x);
         ix = 0x7fffffff&hx;
-    /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0  */
+    /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0, y0(0) is -inf.  */
 	if(ix>=0x7f800000) return  one/(x+x*x);
-        if(ix==0) return -one/zero;
-        if(hx<0) return zero/zero;
+        if(ix==0) return -HUGE_VALF+x;  /* -inf and overflow exception.  */
+        if(hx<0) return zero/(zero*x);
         if(ix >= 0x40000000) {  /* |x| >= 2.0 */
         /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0))
          * where x0 = x-pi/4
diff --git a/sysdeps/ieee754/flt-32/e_j1f.c b/sysdeps/ieee754/flt-32/e_j1f.c
index 26f606a08a..71bb2515af 100644
--- a/sysdeps/ieee754/flt-32/e_j1f.c
+++ b/sysdeps/ieee754/flt-32/e_j1f.c
@@ -134,8 +134,8 @@ static float V0[5] = {
         ix = 0x7fffffff&hx;
     /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
 	if(ix>=0x7f800000) return  one/(x+x*x);
-        if(ix==0) return -one/zero;
-        if(hx<0) return zero/zero;
+        if(ix==0) return -HUGE_VALF+x;  /* -inf and overflow exception.  */
+        if(hx<0) return zero/(zero*x);
         if(ix >= 0x40000000) {  /* |x| >= 2.0 */
 		__sincosf (x, &s, &c);
                 ss = -s-c;
diff --git a/sysdeps/ieee754/flt-32/e_jnf.c b/sysdeps/ieee754/flt-32/e_jnf.c
index 34c4d95a32..de2e53de83 100644
--- a/sysdeps/ieee754/flt-32/e_jnf.c
+++ b/sysdeps/ieee754/flt-32/e_jnf.c
@@ -187,8 +187,8 @@ static float zero  =  0.0000000000e+00;
 	ix = 0x7fffffff&hx;
     /* if Y(n,NaN) is NaN */
 	if(ix>0x7f800000) return x+x;
-	if(ix==0) return -one/zero;
-	if(hx<0) return zero/zero;
+	if(ix==0) return -HUGE_VALF+x;  /* -inf and overflow exception.  */
+	if(hx<0) return zero/(zero*x);
 	sign = 1;
 	if(n<0){
 		n = -n;
diff --git a/sysdeps/ieee754/ldbl-128/e_j0l.c b/sysdeps/ieee754/ldbl-128/e_j0l.c
index d1930987c1..67ef371153 100644
--- a/sysdeps/ieee754/ldbl-128/e_j0l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j0l.c
@@ -827,8 +827,8 @@ long double
   if (x <= 0.0L)
     {
       if (x < 0.0L)
-	return (zero / zero);
-      return 1.0L / zero;
+	return (zero / (zero * x));
+      return -HUGE_VALL + x;
     }
   xx = fabsl (x);
   if (xx <= 2.0L)
diff --git a/sysdeps/ieee754/ldbl-128/e_j1l.c b/sysdeps/ieee754/ldbl-128/e_j1l.c
index 6f0a6f80d8..3a977c2a84 100644
--- a/sysdeps/ieee754/ldbl-128/e_j1l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j1l.c
@@ -834,8 +834,8 @@ __ieee754_y1l (long double x)
   if (x <= 0.0L)
     {
       if (x < 0.0L)
-	return (zero / zero);
-      return -1.0L / zero;
+	return (zero / (zero * x));
+      return -HUGE_VALL + x;
     }
   xx = fabsl (x);
   if (xx <= 2.0L)
diff --git a/sysdeps/ieee754/ldbl-128/e_jnl.c b/sysdeps/ieee754/ldbl-128/e_jnl.c
index e17f0603ed..a4a4e24cf5 100644
--- a/sysdeps/ieee754/ldbl-128/e_jnl.c
+++ b/sysdeps/ieee754/ldbl-128/e_jnl.c
@@ -323,9 +323,9 @@ __ieee754_ynl (n, x)
   if (x <= 0.0L)
     {
       if (x == 0.0L)
-	return -one / zero;
+	return -HUGE_VALL + x;
       if (se & 0x80000000)
-	return zero / zero;
+	return zero / (zero * x);
     }
   sign = 1;
   if (n < 0)
diff --git a/sysdeps/ieee754/ldbl-96/e_j0l.c b/sysdeps/ieee754/ldbl-96/e_j0l.c
index 4439fa641e..12c906bcbc 100644
--- a/sysdeps/ieee754/ldbl-96/e_j0l.c
+++ b/sysdeps/ieee754/ldbl-96/e_j0l.c
@@ -232,11 +232,11 @@ __ieee754_y0l (x)
   ix = se & 0x7fff;
   /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0  */
   if (se & 0x8000)
-    return zero / zero;
+    return zero / (zero * x);
   if (ix >= 0x7fff)
     return one / (x + x * x);
   if ((i0 | i1) == 0)
-    return -one / zero;
+    return -HUGE_VALL + x;  /* -inf and overflow exception.  */
   if (ix >= 0x4000)
     {				/* |x| >= 2.0 */
 
diff --git a/sysdeps/ieee754/ldbl-96/e_j1l.c b/sysdeps/ieee754/ldbl-96/e_j1l.c
index 1ec63c4b44..62a8ce0cb7 100644
--- a/sysdeps/ieee754/ldbl-96/e_j1l.c
+++ b/sysdeps/ieee754/ldbl-96/e_j1l.c
@@ -224,11 +224,11 @@ __ieee754_y1l (x)
   ix = se & 0x7fff;
   /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
   if (se & 0x8000)
-    return zero / zero;
+    return zero / (zero * x);
   if (ix >= 0x7fff)
     return one / (x + x * x);
   if ((i0 | i1) == 0)
-    return -one / zero;
+    return -HUGE_VALL + x;  /* -inf and overflow exception.  */
   if (ix >= 0x4000)
     {				/* |x| >= 2.0 */
       __sincosl (x, &s, &c);
diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c
index 0f2f393230..3d715d36aa 100644
--- a/sysdeps/ieee754/ldbl-96/e_jnl.c
+++ b/sysdeps/ieee754/ldbl-96/e_jnl.c
@@ -36,7 +36,7 @@
  * of order n
  *
  * Special cases:
- *	y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
+ *	y0(0)=y1(0)=yn(n,0) = -inf with overflow signal;
  *	y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
  * Note 2. About jn(n,x), yn(n,x)
  *	For n=0, j0(x) is called,
@@ -312,9 +312,9 @@ __ieee754_ynl (n, x)
   if ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0))
     return x + x;
   if ((ix | i0 | i1) == 0)
-    return -one / zero;
+    return -HUGE_VALL + x;  /* -inf and overflow exception.  */
   if (se & 0x8000)
-    return zero / zero;
+    return zero / (zero * x);
   sign = 1;
   if (n < 0)
     {