diff options
author | Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com> | 2017-02-12 22:36:27 -0200 |
---|---|---|
committer | Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com> | 2017-02-15 10:30:59 -0200 |
commit | 4918e5f4cd63290bb0b2c614f52092ca6a779126 (patch) | |
tree | 1fde6c355b58f36b89fee9dddecc60a7fb29216e /sysdeps/ieee754/flt-32/e_j1f.c | |
parent | 10303eb74bfe33d46ef167d2ea31c746ea1cd6ad (diff) | |
download | glibc-4918e5f4cd63290bb0b2c614f52092ca6a779126.tar.gz glibc-4918e5f4cd63290bb0b2c614f52092ca6a779126.tar.xz glibc-4918e5f4cd63290bb0b2c614f52092ca6a779126.zip |
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.
Diffstat (limited to 'sysdeps/ieee754/flt-32/e_j1f.c')
-rw-r--r-- | sysdeps/ieee754/flt-32/e_j1f.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/ieee754/flt-32/e_j1f.c b/sysdeps/ieee754/flt-32/e_j1f.c index f359a3d9ba..805a87d85b 100644 --- a/sysdeps/ieee754/flt-32/e_j1f.c +++ b/sysdeps/ieee754/flt-32/e_j1f.c @@ -112,7 +112,7 @@ __ieee754_y1f(float x) /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */ if(__builtin_expect(ix>=0x7f800000, 0)) return one/(x+x*x); if(__builtin_expect(ix==0, 0)) - return -HUGE_VALF+x; /* -inf and overflow exception. */ + return -1/zero; /* -inf and divide by zero exception. */ if(__builtin_expect(hx<0, 0)) return zero/(zero*x); if(ix >= 0x40000000) { /* |x| >= 2.0 */ SET_RESTORE_ROUNDF (FE_TONEAREST); |