about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/e_jn.c
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2017-10-03 18:12:42 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2017-10-04 10:15:12 +0100
commit86c27ade1e44e29922d33676f950f7334edb37a7 (patch)
treef1a56c25057b1af6d66df83321beb906c1914fd6 /sysdeps/ieee754/dbl-64/e_jn.c
parent8f8f8ef7aba40ef883291e4c4d95a419c3327d70 (diff)
downloadglibc-86c27ade1e44e29922d33676f950f7334edb37a7.tar.gz
glibc-86c27ade1e44e29922d33676f950f7334edb37a7.tar.xz
glibc-86c27ade1e44e29922d33676f950f7334edb37a7.zip
[BZ #22244] Fix yn(n,0) without SVID wrapper
Without SVID compat wrapper yn(n,0) and ynf(n,0) does not raise
the divide-by-zero excpetion and it may return inf with the wrong
sign for n < 0.

	[BZ #22244]
	* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_yn): Fix x == 0 case.
	* sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_ynf): Likewise.
Diffstat (limited to 'sysdeps/ieee754/dbl-64/e_jn.c')
-rw-r--r--sysdeps/ieee754/dbl-64/e_jn.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c
index 3ac91df2b0..a244df0e0a 100644
--- a/sysdeps/ieee754/dbl-64/e_jn.c
+++ b/sysdeps/ieee754/dbl-64/e_jn.c
@@ -268,11 +268,6 @@ __ieee754_yn (int n, double x)
   /* if Y(n,NaN) is NaN */
   if (__glibc_unlikely ((ix | ((uint32_t) (lx | -lx)) >> 31) > 0x7ff00000))
     return x + x;
-  if (__glibc_unlikely ((ix | lx) == 0))
-    return -HUGE_VAL + x;
-  /* -inf and overflow exception.  */;
-  if (__glibc_unlikely (hx < 0))
-    return zero / (zero * x);
   sign = 1;
   if (n < 0)
     {
@@ -281,6 +276,11 @@ __ieee754_yn (int n, double x)
     }
   if (n == 0)
     return (__ieee754_y0 (x));
+  if (__glibc_unlikely ((ix | lx) == 0))
+    return -sign / zero;
+  /* -inf and overflow exception.  */;
+  if (__glibc_unlikely (hx < 0))
+    return zero / (zero * x);
   {
     SET_RESTORE_ROUND (FE_TONEAREST);
     if (n == 1)