From 4918e5f4cd63290bb0b2c614f52092ca6a779126 Mon Sep 17 00:00:00 2001 From: "Gabriel F. T. Gomes" Date: Sun, 12 Feb 2017 22:36:27 -0200 Subject: Fix y0 and y1 exception handling for zero input [BZ #21134] The Bessel functions of the second type (Yn) should raise the "divide by zero" exception when input is zero (both positive and negative). Current code gives the right output, but fails to set the exception. This error is exposed for float, double, and long double when linking with -lieee. Without this flag, the error is not exposed, because the wrappers for these functions, which use __kernel_standard functionality, set the exception as expected. Tested for powerpc64le. [BZ #21134] * sysdeps/ieee754/dbl-64/e_j0.c (__ieee754_y0): Raise the "divide by zero" exception when the input is zero. * sysdeps/ieee754/dbl-64/e_j1.c (__ieee754_y1): Likewise. * sysdeps/ieee754/flt-32/e_j0f.c (__ieee754_y0f): Likewise. * sysdeps/ieee754/flt-32/e_j1f.c (__ieee754_y1f): Likewise. * sysdeps/ieee754/ldbl-128/e_j0l.c (__ieee754_y0l): Likewise. * sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_y1l): Likewise. --- sysdeps/ieee754/flt-32/e_j0f.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysdeps/ieee754/flt-32/e_j0f.c') diff --git a/sysdeps/ieee754/flt-32/e_j0f.c b/sysdeps/ieee754/flt-32/e_j0f.c index bd0b80fdb0..b783dd069d 100644 --- a/sysdeps/ieee754/flt-32/e_j0f.c +++ b/sysdeps/ieee754/flt-32/e_j0f.c @@ -105,7 +105,7 @@ __ieee754_y0f(float x) ix = 0x7fffffff&hx; /* 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 -HUGE_VALF+x; /* -inf and overflow exception. */ + if(ix==0) return -1/zero; /* -inf and divide by zero 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)) -- cgit 1.4.1