about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/e_jn.c
diff options
context:
space:
mode:
authorPetr Baudis <pasky@suse.cz>2011-09-09 22:16:10 -0400
committerUlrich Drepper <drepper@gmail.com>2011-09-09 22:16:10 -0400
commit1248c1c41508387ff282b208636737e8cdc9b5b0 (patch)
treef2de6f410de805293483964814aa29efefbe8daa /sysdeps/ieee754/dbl-64/e_jn.c
parentf19009c1551a396ee8eff96a83254243ce25a090 (diff)
downloadglibc-1248c1c41508387ff282b208636737e8cdc9b5b0.tar.gz
glibc-1248c1c41508387ff282b208636737e8cdc9b5b0.tar.xz
glibc-1248c1c41508387ff282b208636737e8cdc9b5b0.zip
Fix jn precision
Diffstat (limited to 'sysdeps/ieee754/dbl-64/e_jn.c')
-rw-r--r--sysdeps/ieee754/dbl-64/e_jn.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c
index bf4a13d974..d9d6f91762 100644
--- a/sysdeps/ieee754/dbl-64/e_jn.c
+++ b/sysdeps/ieee754/dbl-64/e_jn.c
@@ -215,7 +215,16 @@ static double zero  =  0.00000000000000000000e+00;
 			}
 	     	    }
 		}
-	    	b = (t*__ieee754_j0(x)/b);
+		/* j0() and j1() suffer enormous loss of precision at and
+		 * near zero; however, we know that their zero points never
+		 * coincide, so just choose the one further away from zero.
+		 */
+		z = __ieee754_j0 (x);
+		w = __ieee754_j1 (x);
+		if (fabs (z) >= fabs (w))
+		  b = (t * z / b);
+		else
+		  b = (t * w / a);
 	    }
 	}
 	if(sgn==1) return -b; else return b;