public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/15319] New: Missing underflow exceptions from atan / atan2
@ 2013-03-28 20:55 jsm28 at gcc dot gnu.org
  2014-01-31 23:19 ` [Bug math/15319] " zimmerma+gcc at loria dot fr
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2013-03-28 20:55 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=15319

             Bug #: 15319
           Summary: Missing underflow exceptions from atan / atan2
           Product: glibc
           Version: 2.17
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: unassigned@sourceware.org
        ReportedBy: jsm28@gcc.gnu.org
    Classification: Unclassified


Various implementations of atan and atan2 functions fail to raise underflow
exceptions for subnormal arguments (when the result is very close to an input
subnormal, but inexact so should raise underflow).  For example, on x86_64,
atan2f (0x1.fp-129f, 1.0f) returns the correct result 0x1.fp-129f but fails to
raise an underflow exception.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- 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/15319] Missing underflow exceptions from atan / atan2
  2013-03-28 20:55 [Bug math/15319] New: Missing underflow exceptions from atan / atan2 jsm28 at gcc dot gnu.org
@ 2014-01-31 23:19 ` zimmerma+gcc at loria dot fr
  2014-02-02 20:43 ` 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-01-31 23:19 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15319

Paul Zimmermann <zimmerma+gcc at loria dot fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zimmerma+gcc at loria dot fr

--- Comment #1 from Paul Zimmermann <zimmerma+gcc at loria dot fr> ---
confirmed on x86_64, where atanf(0x1p-149) does not raise an 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/15319] Missing underflow exceptions from atan / atan2
  2013-03-28 20:55 [Bug math/15319] New: Missing underflow exceptions from atan / atan2 jsm28 at gcc dot gnu.org
  2014-01-31 23:19 ` [Bug math/15319] " zimmerma+gcc at loria dot fr
@ 2014-02-02 20:43 ` zimmerma+gcc at loria dot fr
  2014-02-07  7:41 ` 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-02 20:43 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15319

--- Comment #2 from Paul Zimmermann <zimmerma+gcc at loria dot fr> ---
idem in double precision for atan(0x1p-1074) on x86_64

-- 
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/15319] Missing underflow exceptions from atan / atan2
  2013-03-28 20:55 [Bug math/15319] New: Missing underflow exceptions from atan / atan2 jsm28 at gcc dot gnu.org
  2014-01-31 23:19 ` [Bug math/15319] " zimmerma+gcc at loria dot fr
  2014-02-02 20:43 ` zimmerma+gcc at loria dot fr
@ 2014-02-07  7:41 ` zimmerma+gcc at loria dot fr
  2014-06-13 18:35 ` fweimer at redhat dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zimmerma+gcc at loria dot fr @ 2014-02-07  7:41 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15319

--- Comment #3 from Paul Zimmermann <zimmerma+gcc at loria dot fr> ---
idem in extended precision:

Testing function atan for exponent 53 [seed=8344].
 rounding mode MPFR_RNDU:
      wrong underflow flag for x=4.0000000000000000@-4096
      library gives 4.0000000000000000@-4096
      mpfr    gives 4.0000000000000000@-4096
      underflow: mpfr 1, library 0

-- 
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/15319] Missing underflow exceptions from atan / atan2
  2013-03-28 20:55 [Bug math/15319] New: Missing underflow exceptions from atan / atan2 jsm28 at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-02-07  7:41 ` zimmerma+gcc at loria dot fr
@ 2014-06-13 18:35 ` fweimer at redhat dot com
  2015-02-18 21:12 ` cvs-commit at gcc dot gnu.org
  2015-02-18 21:13 ` jsm28 at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 18:35 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15319

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

* [Bug math/15319] Missing underflow exceptions from atan / atan2
  2013-03-28 20:55 [Bug math/15319] New: Missing underflow exceptions from atan / atan2 jsm28 at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-06-13 18:35 ` fweimer at redhat dot com
@ 2015-02-18 21:12 ` cvs-commit at gcc dot gnu.org
  2015-02-18 21:13 ` jsm28 at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-02-18 21:12 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15319

--- 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  4629c866ad79167d60ca9bf263d871eabb59d3d9 (commit)
      from  9ee16d8b34d3ee8bdb78231a3c749cd39b1235ac (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=4629c866ad79167d60ca9bf263d871eabb59d3d9

commit 4629c866ad79167d60ca9bf263d871eabb59d3d9
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Feb 18 21:10:49 2015 +0000

    Fix atan / atan2 missing underflows (bug 15319).

    This patch fixes bug 15319, missing underflows from atan / atan2 when
    the result of atan is very close to its small argument (or that of
    atan2 is very close to the ratio of its arguments, which may be an
    exact division).

    The usual approach of doing an underflowing computation if the
    computed result is subnormal is followed.  For 32-bit x86, there are
    extra complications: the inline __ieee754_atan2 in bits/mathinline.h
    needs to be disabled for float and double because other libm functions
    using it generally rely on getting proper underflow exceptions from
    it, while the out-of-line functions have to remove excess range and
    precision from the underflowing result so as to return an exact 0 in
    the case where errno should be set for underflow to 0.  (The failures
    I saw without that are similar to those Carlos reported for other
    functions, where I haven't seen a response to
    <https://sourceware.org/ml/libc-alpha/2015-01/msg00485.html>
    confirming if my diagnosis is correct.  Arguably all libm functions
    with float and double returns should remove excess range and
    precision, but that's a separate matter.)

    The x86_64 long double case reported in a comment in bug 15319 is not
    a bug (it's an argument of LDBL_MIN, and x86_64 is an after-rounding
    architecture so the correct IEEE result is not to raise underflow in
    the given rounding mode, in addition to treating the result as an
    exact LDBL_MIN being within the newly clarified documentation of
    accuracy goals).  I'm presuming that the fpatan instruction can be
    trusted to raise appropriate exceptions when the (long double) result
    underflows (after rounding) and so no changes are needed for x86 /
    x86_64 long double functions here; empirically this is the case for
    the cases covered in the testsuite, on my system.

    Tested for x86_64, x86, powerpc and mips64.  Only 32-bit x86 needs
    ulps updates (for the changes to inlines meaning some functions no
    longer get excess precision from their __ieee754_atan2* calls).

        [BZ #15319]
        * sysdeps/i386/fpu/e_atan2.S (dbl_min): New object.
        (MO): New macro.
        (__ieee754_atan2): For results with small absolute value, force
        underflow exception and remove excess range and precision from
        return value.
        * sysdeps/i386/fpu/e_atan2f.S (flt_min): New object.
        (MO): New macro.
        (__ieee754_atan2f): For results with small absolute value, force
        underflow exception and remove excess range and precision from
        return value.
        * sysdeps/i386/fpu/s_atan.S (dbl_min): New object.
        (MO): New macro.
        (__atan): For results with small absolute value, force underflow
        exception and remove excess range and precision from return value.
        * sysdeps/i386/fpu/s_atanf.S (flt_min): New object.
        (MO): New macro.
        (__atanf): For results with small absolute value, force underflow
        exception and remove excess range and precision from return value.
        * sysdeps/ieee754/dbl-64/e_atan2.c: Include <float.h> and
        <math.h>.
        (__ieee754_atan2): Force underflow exception for results with
        small absolute value.
        * sysdeps/ieee754/dbl-64/s_atan.c: Include <float.h> and
        <math_private.h>.
        (atan): Force underflow exception for results with small absolute
        value.
        * sysdeps/ieee754/flt-32/s_atanf.c: Include <float.h>.
        (__atanf): Force underflow exception for results with small
        absolute value.
        * sysdeps/ieee754/ldbl-128/s_atanl.c: Include <float.h> and
        <math.h>.
        (__atanl): Force underflow exception for results with small
        absolute value.
        * sysdeps/ieee754/ldbl-128ibm/s_atanl.c: Include <float.h>.
        (__atanl): Force underflow exception for results with small
        absolute value.
        * sysdeps/x86/fpu/bits/mathinline.h
        [!__SSE2_MATH__ && !__x86_64__ && __LIBC_INTERNAL_MATH_INLINES]
        (__ieee754_atan2): Only define inline for long double.
        * sysdeps/x86_64/fpu/multiarch/e_atan2.c
        [HAVE_FMA4_SUPPORT || HAVE_AVX_SUPPORT]: Include <math.h>.
        * math/auto-libm-test-in: Do not mark underflow exceptions as
        possibly missing for bug 15319.  Add more tests of atan2.
        * math/auto-libm-test-out: Regenerated.
        * math/libm-test.inc (casin_test_data): Do not mark underflow
        exceptions as possibly missing for bug 15319.
        (casinh_test_data): Likewise.
        * sysdeps/i386/fpu/libm-test-ulps: Update.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                              |   52 +
 NEWS                                   |    4 +-
 math/auto-libm-test-in                 |   36 +-
 math/auto-libm-test-out                | 2434 ++++++++++++++++++++------------
 math/libm-test.inc                     |   90 +-
 sysdeps/i386/fpu/e_atan2.S             |   35 +-
 sysdeps/i386/fpu/e_atan2f.S            |   35 +-
 sysdeps/i386/fpu/libm-test-ulps        |   24 +-
 sysdeps/i386/fpu/s_atan.S              |   33 +-
 sysdeps/i386/fpu/s_atanf.S             |   33 +-
 sysdeps/ieee754/dbl-64/e_atan2.c       |   14 +-
 sysdeps/ieee754/dbl-64/s_atan.c        |   11 +-
 sysdeps/ieee754/flt-32/s_atanf.c       |    6 +
 sysdeps/ieee754/ldbl-128/s_atanl.c     |    7 +
 sysdeps/ieee754/ldbl-128ibm/s_atanl.c  |    6 +
 sysdeps/x86/fpu/bits/mathinline.h      |   12 +-
 sysdeps/x86_64/fpu/multiarch/e_atan2.c |    1 +
 17 files changed, 1840 insertions(+), 993 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/15319] Missing underflow exceptions from atan / atan2
  2013-03-28 20:55 [Bug math/15319] New: Missing underflow exceptions from atan / atan2 jsm28 at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-02-18 21:12 ` cvs-commit at gcc dot gnu.org
@ 2015-02-18 21:13 ` jsm28 at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2015-02-18 21:13 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15319

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.22.

-- 
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:[~2015-02-18 21:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-28 20:55 [Bug math/15319] New: Missing underflow exceptions from atan / atan2 jsm28 at gcc dot gnu.org
2014-01-31 23:19 ` [Bug math/15319] " zimmerma+gcc at loria dot fr
2014-02-02 20:43 ` zimmerma+gcc at loria dot fr
2014-02-07  7:41 ` zimmerma+gcc at loria dot fr
2014-06-13 18:35 ` fweimer at redhat dot com
2015-02-18 21:12 ` cvs-commit at gcc dot gnu.org
2015-02-18 21:13 ` jsm28 at gcc dot gnu.org

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).