public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] [BZ 21130] ldbl-128: Fix y0 and y1 for -Inf input
@ 2017-02-10 19:28 Gabriel F. T. Gomes
  2017-02-10 20:55 ` Joseph Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriel F. T. Gomes @ 2017-02-10 19:28 UTC (permalink / raw)
  To: libc-alpha

The Bessel functions of the second type (Yn) are not defined for
negative input and should return NAN with the "invalid" exception
raised, in these cases.  However, current code checks for infinity and
return zero, regardless of the sign.  This error is exposed for 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, return the correct value.

Tested for powerpc64le.

2017-01-10  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>

	[BZ 21130]
	* sysdeps/ieee754/ldbl-128/e_j0l.c (__ieee754_y0l): Return NAN
	with the "invalid" exception raised when x is -Inf.
	* sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_y1l): Likewise.
---
 sysdeps/ieee754/ldbl-128/e_j0l.c | 7 +------
 sysdeps/ieee754/ldbl-128/e_j1l.c | 7 +------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/sysdeps/ieee754/ldbl-128/e_j0l.c b/sysdeps/ieee754/ldbl-128/e_j0l.c
index d711007..855b5a5 100644
--- a/sysdeps/ieee754/ldbl-128/e_j0l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j0l.c
@@ -829,12 +829,7 @@ _Float128
   _Float128 xx, xinv, z, p, q, c, s, cc, ss;
 
   if (! isfinite (x))
-    {
-      if (x != x)
-	return x + x;
-      else
-	return 0;
-    }
+    return 1 / (x + x * x);
   if (x <= 0)
     {
       if (x < 0)
diff --git a/sysdeps/ieee754/ldbl-128/e_j1l.c b/sysdeps/ieee754/ldbl-128/e_j1l.c
index 9e78230..db8dca0 100644
--- a/sysdeps/ieee754/ldbl-128/e_j1l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j1l.c
@@ -847,12 +847,7 @@ __ieee754_y1l (_Float128 x)
   _Float128 xx, xinv, z, p, q, c, s, cc, ss;
 
   if (! isfinite (x))
-    {
-      if (x != x)
-	return x + x;
-      else
-	return 0;
-    }
+    return 1 / (x + x * x);
   if (x <= 0)
     {
       if (x < 0)
-- 
2.4.11

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] [BZ 21130] ldbl-128: Fix y0 and y1 for -Inf input
  2017-02-10 19:28 [PATCH v2] [BZ 21130] ldbl-128: Fix y0 and y1 for -Inf input Gabriel F. T. Gomes
@ 2017-02-10 20:55 ` Joseph Myers
  2017-02-12 20:48   ` Gabriel F. T. Gomes
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph Myers @ 2017-02-10 20:55 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

On Fri, 10 Feb 2017, Gabriel F. T. Gomes wrote:

> The Bessel functions of the second type (Yn) are not defined for
> negative input and should return NAN with the "invalid" exception
> raised, in these cases.  However, current code checks for infinity and
> return zero, regardless of the sign.  This error is exposed for 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, return the correct value.
> 
> Tested for powerpc64le.

OK.

> 	[BZ 21130]

Note that there is a # before the bug number in the ChangeLog syntax, 
"[BZ #21130]".

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] [BZ 21130] ldbl-128: Fix y0 and y1 for -Inf input
  2017-02-10 20:55 ` Joseph Myers
@ 2017-02-12 20:48   ` Gabriel F. T. Gomes
  0 siblings, 0 replies; 3+ messages in thread
From: Gabriel F. T. Gomes @ 2017-02-12 20:48 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

On Fri, 10 Feb 2017 20:55:13 +0000
Joseph Myers <joseph@codesourcery.com> wrote:

> On Fri, 10 Feb 2017, Gabriel F. T. Gomes wrote:
> 
> > The Bessel functions of the second type (Yn) are not defined for
> > negative input and should return NAN with the "invalid" exception
> > raised, in these cases.  However, current code checks for infinity and
> > return zero, regardless of the sign.  This error is exposed for 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, return the correct value.
> > 
> > Tested for powerpc64le.  
> 
> OK.
> 
> > 	[BZ 21130]  
> 
> Note that there is a # before the bug number in the ChangeLog syntax, 
> "[BZ #21130]".
> 

Thanks.  Pushed with this change as b987917e6aa7.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-12 20:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-10 19:28 [PATCH v2] [BZ 21130] ldbl-128: Fix y0 and y1 for -Inf input Gabriel F. T. Gomes
2017-02-10 20:55 ` Joseph Myers
2017-02-12 20:48   ` Gabriel F. T. Gomes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).