public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/16516] New: spurious underflow exception from erff
@ 2014-01-31 22:31 zimmerma+gcc at loria dot fr
2014-02-01 9:35 ` [Bug math/16516] " zimmerma+gcc at loria dot fr
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: zimmerma+gcc at loria dot fr @ 2014-01-31 22:31 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=16516
Bug ID: 16516
Summary: spurious underflow exception from erff
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: math
Assignee: unassigned at sourceware dot org
Reporter: zimmerma+gcc at loria dot fr
Created attachment 7381
--> https://sourceware.org/bugzilla/attachment.cgi?id=7381&action=edit
test case
on x86_64 in single precision I get with the attached program:
GNU libc version: 2.18.90
GNU libc release: development
x=0x1.c5bf94p-127 (1.041755126e-38)
libc: erff(x)=0x1.000006p-126 (1.175494771e-38) underflow=16
mpfr: erff(x)=0x1.000006p-126 (1.175494771e-38)
ulp difference: 0.000000
See http://webloria.loria.fr/~zimmerma/glibc/
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug math/16516] spurious underflow exception from erff
2014-01-31 22:31 [Bug math/16516] New: spurious underflow exception from erff zimmerma+gcc at loria dot fr
@ 2014-02-01 9:35 ` zimmerma+gcc at loria dot fr
2014-02-04 9:53 ` zimmerma+gcc at loria dot fr
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: zimmerma+gcc at loria dot fr @ 2014-02-01 9:35 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=16516
--- Comment #1 from Paul Zimmermann <zimmerma+gcc at loria dot fr> ---
here is another example with rounding up:
rounding mode MPFR_RNDU:
wrong underflow flag for x=3.8b7fa8@-32
library gives 4.0000b0@-32
mpfr gives 4.0000b0@-32
underflow: mpfr 0, library 16
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug math/16516] spurious underflow exception from erff
2014-01-31 22:31 [Bug math/16516] New: spurious underflow exception from erff zimmerma+gcc at loria dot fr
2014-02-01 9:35 ` [Bug math/16516] " zimmerma+gcc at loria dot fr
@ 2014-02-04 9:53 ` zimmerma+gcc at loria dot fr
2014-02-07 8:10 ` zimmerma+gcc at loria dot fr
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: zimmerma+gcc at loria dot fr @ 2014-02-04 9:53 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=16516
--- Comment #2 from Paul Zimmermann <zimmerma+gcc at loria dot fr> ---
and another example in double precision:
Testing function erf for exponent 0 [seed=7626].
rounding mode MPFR_RNDN:
wrong underflow flag for x=-3.8b7f12369ded8@-256
library gives -4.0000000000004@-256
mpfr gives -4.0000000000004@-256
underflow: mpfr 0, library 16
Since the result is larger in magnitude than the smallest normal number
0x1p-1022, we should get no underflow exception.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug math/16516] spurious underflow exception from erff
2014-01-31 22:31 [Bug math/16516] New: spurious underflow exception from erff zimmerma+gcc at loria dot fr
2014-02-01 9:35 ` [Bug math/16516] " zimmerma+gcc at loria dot fr
2014-02-04 9:53 ` zimmerma+gcc at loria dot fr
@ 2014-02-07 8:10 ` zimmerma+gcc at loria dot fr
2014-05-14 12:35 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: zimmerma+gcc at loria dot fr @ 2014-02-07 8:10 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=16516
--- Comment #3 from Paul Zimmermann <zimmerma+gcc at loria dot fr> ---
idem in extended precision:
Testing function erf for exponent 0 [seed=8344].
rounding mode MPFR_RNDN:
wrong underflow flag for x=3.8b7f12369ded5518@-4096
library gives 4.0000000000000028@-4096
mpfr gives 4.0000000000000028@-4096
underflow: mpfr 0, library 16
Note the glibc result is *above* the smallest normal number.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug math/16516] spurious underflow exception from erff
2014-01-31 22:31 [Bug math/16516] New: spurious underflow exception from erff zimmerma+gcc at loria dot fr
` (2 preceding siblings ...)
2014-02-07 8:10 ` zimmerma+gcc at loria dot fr
@ 2014-05-14 12:35 ` cvs-commit at gcc dot gnu.org
2014-05-14 12:40 ` jsm28 at gcc dot gnu.org
2014-06-13 8:49 ` fweimer at redhat dot com
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-05-14 12:35 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=16516
--- Comment #4 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 0bf061d3e37e0f72c2378cbded67c58df4f58a4b (commit)
from 3d8c8bff798a15b6dc0ee94d24fc877db9706589 (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=0bf061d3e37e0f72c2378cbded67c58df4f58a4b
commit 0bf061d3e37e0f72c2378cbded67c58df4f58a4b
Author: Joseph Myers <joseph@codesourcery.com>
Date: Wed May 14 12:34:03 2014 +0000
Fix erf underflow handling near 0 (bug 16516).
Bug 16516 reports spurious underflows from erf (for all floating-point
types), when the result is close to underflowing but does not actually
underflow.
erf (x) is about (2/sqrt(pi))*x for x close to 0, so there are
subnormal arguments for which it does not underflow. The various
implementations do (x + efx*x) (for efx = 2/sqrt(pi) - 1), for greater
accuracy than if just using a single multiplication by an
approximation to 2/sqrt(pi) (effectively, this way there are a few
more bits in the approximation to 2/sqrt(pi)). This can introduce
underflows when efx*x underflows even though the final result does
not, so a scaled calculation with 8*efx is done in these cases - but 8
is not a big enough scale factor to avoid all such underflows. 16 is
(any underflows with a scale factor of 16 would only occur when the
final result underflows), so this patch changes the code to use that
factor. Rather than recomputing all the values of the efx8 variable,
it is removed, leaving it to the compiler's constant folding to
compute 16*efx. As such scaling can also lose underflows when the
final scaling down happens to be exact, appropriate checks are added
to ensure underflow exceptions occur when required in such cases.
Tested x86_64 and x86; no ulps updates needed. Also spot-checked for
powerpc32 and mips64 to verify the changes to the ldbl-128ibm and
ldbl-128 implementations.
[BZ #16516]
* sysdeps/ieee754/dbl-64/s_erf.c (efx8): Remove variable.
(__erf): Scale by 16 instead of 8 in potentially underflowing
case. Ensure exception if result actually underflows.
* sysdeps/ieee754/flt-32/s_erff.c (efx8): Remove variable.
(__erff): Scale by 16 instead of 8 in potentially underflowing
case. Ensure exception if result actually underflows.
* sysdeps/ieee754/ldbl-128/s_erfl.c: Include <float.h>.
(efx8): Remove variable.
(__erfl): Scale by 16 instead of 8 in potentially underflowing
case. Ensure exception if result actually underflows.
* sysdeps/ieee754/ldbl-128ibm/s_erfl.c: Include <float.h>.
(efx8): Remove variable.
(__erfl): Scale by 16 instead of 8 in potentially underflowing
case. Ensure exception if result actually underflows.
* sysdeps/ieee754/ldbl-96/s_erfl.c: Include <float.h>.
(efx8): Remove variable.
(__erfl): Scale by 16 instead of 8 in potentially underflowing
case. Ensure exception if result actually underflows.
* math/auto-libm-test-in: Add more tests of erf.
* math/auto-libm-test-out: Regenerated.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 24 ++++
NEWS | 13 +-
math/auto-libm-test-in | 4 +
math/auto-libm-test-out | 200 ++++++++++++++++++++++++++++++++++
sysdeps/ieee754/dbl-64/s_erf.c | 12 ++-
sysdeps/ieee754/flt-32/s_erff.c | 13 ++-
sysdeps/ieee754/ldbl-128/s_erfl.c | 16 ++-
sysdeps/ieee754/ldbl-128ibm/s_erfl.c | 16 ++-
sysdeps/ieee754/ldbl-96/s_erfl.c | 14 ++-
9 files changed, 289 insertions(+), 23 deletions(-)
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug math/16516] spurious underflow exception from erff
2014-01-31 22:31 [Bug math/16516] New: spurious underflow exception from erff zimmerma+gcc at loria dot fr
` (3 preceding siblings ...)
2014-05-14 12:35 ` cvs-commit at gcc dot gnu.org
@ 2014-05-14 12:40 ` jsm28 at gcc dot gnu.org
2014-06-13 8:49 ` fweimer at redhat dot com
5 siblings, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2014-05-14 12:40 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=16516
Joseph Myers <jsm28 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
Fixed for 2.20.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug math/16516] spurious underflow exception from erff
2014-01-31 22:31 [Bug math/16516] New: spurious underflow exception from erff zimmerma+gcc at loria dot fr
` (4 preceding siblings ...)
2014-05-14 12:40 ` jsm28 at gcc dot gnu.org
@ 2014-06-13 8:49 ` fweimer at redhat dot com
5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 8:49 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=16516
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Flags| |security-
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-06-13 8:49 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-31 22:31 [Bug math/16516] New: spurious underflow exception from erff zimmerma+gcc at loria dot fr
2014-02-01 9:35 ` [Bug math/16516] " zimmerma+gcc at loria dot fr
2014-02-04 9:53 ` zimmerma+gcc at loria dot fr
2014-02-07 8:10 ` zimmerma+gcc at loria dot fr
2014-05-14 12:35 ` cvs-commit at gcc dot gnu.org
2014-05-14 12:40 ` jsm28 at gcc dot gnu.org
2014-06-13 8:49 ` fweimer at redhat dot com
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).