This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/20940] hypot sNaN handling
- From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Wed, 07 Dec 2016 01:17:33 +0000
- Subject: [Bug math/20940] hypot sNaN handling
- Auto-submitted: auto-generated
- References: <bug-20940-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=20940
--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 58307649fb51a3a6adc29a8659d3301393f24671 (commit)
from a91fd168a0db38563528dab1a13180fda2a5040c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=58307649fb51a3a6adc29a8659d3301393f24671
commit 58307649fb51a3a6adc29a8659d3301393f24671
Author: Joseph Myers <joseph@codesourcery.com>
Date: Wed Dec 7 01:16:36 2016 +0000
Fix hypot sNaN handling (bug 20940).
TS 18661-1 generally defines libm functions taking sNaN arguments to
return qNaN and raise "invalid", even for the cases where a
corresponding qNaN argument would not result in a qNaN return. This
includes hypot with one argument being an infinity and the other being
an sNaN. This patch duly fixes hypot implementatations in glibc
(generic and powerpc) to ensure qNaN, computed by arithmetic on the
arguments, is returned in that case.
Various implementations do their checks for infinities and NaNs inline
by manipulating the representations of the arguments. For simplicity,
this patch just uses issignaling to check for sNaN arguments. This
could be inlined like the existing code (with due care about reversed
quiet NaN conventions, for implementations where that is relevant),
but given that all these checks are in cases where it's already known
at least one argument is not finite, which should be the uncommon
case, that doesn't seem worthwhile unless performance issues are
observed in practice.
Tested for x86_64, x86, mips64 and powerpc.
[BZ #20940]
* sysdeps/ieee754/dbl-64/e_hypot.c (__ieee754_hypot): Do not
return Inf for arguments Inf and sNaN.
* sysdeps/ieee754/flt-32/e_hypotf.c (__ieee754_hypotf): Likewise.
* sysdeps/ieee754/ldbl-128/e_hypotl.c (__ieee754_hypotl):
Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_hypotl.c (__ieee754_hypotl):
Likewise.
* sysdeps/ieee754/ldbl-96/e_hypotl.c (__ieee754_hypotl): Likewise.
* sysdeps/powerpc/fpu/e_hypot.c (TEST_INF_NAN): Do not return Inf
for arguments Inf and sNaN. When returning a NaN, compute it by
arithmetic on the arguments.
* sysdeps/powerpc/fpu/e_hypotf.c (TEST_INF_NAN): Likewise.
* math/libm-test.inc (pow_test_data): Add tests of sNaN arguments.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 17 ++++++++++
math/libm-test.inc | 52 ++++++++++++++++++++++++++++++++
sysdeps/ieee754/dbl-64/e_hypot.c | 2 +
sysdeps/ieee754/flt-32/e_hypotf.c | 4 +-
sysdeps/ieee754/ldbl-128/e_hypotl.c | 2 +
sysdeps/ieee754/ldbl-128ibm/e_hypotl.c | 2 +
sysdeps/ieee754/ldbl-96/e_hypotl.c | 2 +
sysdeps/powerpc/fpu/e_hypot.c | 10 ++++--
sysdeps/powerpc/fpu/e_hypotf.c | 10 ++++--
9 files changed, 91 insertions(+), 10 deletions(-)
--
You are receiving this mail because:
You are on the CC list for the bug.