public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/16315] New: Bad overflowing pow results for directed rounding
@ 2013-12-11  1:00 jsm28 at gcc dot gnu.org
  2013-12-11  1:22 ` [Bug math/16315] " jsm28 at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2013-12-11  1:00 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 16315
           Summary: Bad overflowing pow results for directed rounding
           Product: glibc
           Version: 2.19
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: jsm28 at gcc dot gnu.org

The results of pow on overflow should respect the rounding mode and the sign of
the result.  Instead, for dbl-64 on x86_64 at least, they are infinities
regardless of the rounding mode, e.g.:

Failure: Test: pow_towardzero (-0x2p+0, 0x1.fffffep+112)
Result:
 is:          inf   inf
 should be:   1.79769313486231570814e+308   0x1.fffffffffffff0000000p+1023

-- 
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/16315] Bad overflowing pow results for directed rounding
  2013-12-11  1:00 [Bug math/16315] New: Bad overflowing pow results for directed rounding jsm28 at gcc dot gnu.org
@ 2013-12-11  1:22 ` jsm28 at gcc dot gnu.org
  2014-03-21  0:04 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2013-12-11  1:22 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
Similar issues apply for x86_64 powl as well, including cases where the error
is in the other direction, e.g.:

Failure: Test: pow_downward (-0x2p+0, 0x1.fffffffffffffp+52)
Result:
 is:         -1.18973149535723176503e+4932  -0xf.fffffffffffffff00000p+16380
 should be:  -inf  -inf

-- 
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/16315] Bad overflowing pow results for directed rounding
  2013-12-11  1:00 [Bug math/16315] New: Bad overflowing pow results for directed rounding jsm28 at gcc dot gnu.org
  2013-12-11  1:22 ` [Bug math/16315] " jsm28 at gcc dot gnu.org
@ 2014-03-21  0:04 ` cvs-commit at gcc dot gnu.org
  2014-06-13 11:25 ` fweimer at redhat dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-03-21  0:04 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #2 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  8c92dfff412c20dc0c483ea68444d093a5672de0 (commit)
      from  6eaf95cbfa0031ea267682dc2c9c17ed3e3dc167 (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=8c92dfff412c20dc0c483ea68444d093a5672de0

commit 8c92dfff412c20dc0c483ea68444d093a5672de0
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Fri Mar 21 00:03:38 2014 +0000

    Test most libm functions in all rounding modes.

    This patch makes libm-test.inc tests of most functions use ALL_RM_TEST
    unless there was some reason to defer that change for a particular
    function.

    I started out planning to defer the change for pow (bug 16315), cexp /
    ccos / ccosh / csin / csinh (likely fallout from exp, bug 16284) and
    cpow (exact expectations for signs of exact zero results not wanted).
    Testing on x86_64 and x86 showed additional failures for acosh, cacos,
    catan, catanh, clog, clog10, jn, log, log10, log1p, log2, tgamma, yn,
    so making the change for those functions was deferred as well, pending
    investigation to show which of these represent distinct bugs (some
    such bugs may already be filed) and appropriate fixing / XFAILing.
    Failures include wrong signs of zero results, errors slightly above
    the 9ulp bound (in such cases it may make sense for functions to set
    round-to-nearest internally to reduce error accumulation), large
    errors and incorrect overflow/underflow for the rounding mode (with
    consequent missing errno settings in some cases).  It's possible some
    could be issues with test expectations, though I didn't notice any
    that were obviously like that (I added NO_TEST_INLINE for cases that
    were failing for ildoubl on x86 and where it seemed reasonable for
    them to fail for the fast-math inlines).

    There may of course be failures on other architectures for functions
    that didn't fail on x86_64 or x86, in which case the usual rule
    applies: file a bug (preferably identifying the underlying problem
    function, in cases where function A calls function B and a problem
    with function B may present in the test results for function A) if not
    already in Bugzilla then fix or XFAIL.

    Tested x86_64 and x86 and ulps updated accordingly.

        * math/libm-test.inc (asinh_test): Use ALL_RM_TEST.
        (atan_test): Likewise.
        (atanh_test_data): Use NO_TEST_INLINE for two tests.
        (atanh_test): Use ALL_RM_TEST.
        (atan2_test_data): Likewise.
        (cabs_test): Likewise.
        (cacosh_test): Likewise.
        (carg_test): Likewise.
        (casin_test): Likewise.
        (casinh_test): Likewise.
        (cbrt_test): Likewise.
        (csqrt_test): Likewise.
        (erf_test): Likewise.
        (erfc_test): Likewise.
        (pow10_test): Likewise.
        (exp2_test): Likewise.
        (hypot_test): Likewise.
        (j0_test): Likewise.
        (j1_test): Likewise.
        (lgamma_test): Likewise.
        (gamma_test): Likewise.
        (sincos_test): Likewise.
        (tanh_test): Likewise.
        (y0_test): Likewise.
        (y1_test): Likewise.
        * sysdeps/i386/fpu/libm-test-ulps: Update.
        * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

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

Summary of changes:
 ChangeLog                         |   30 ++
 math/libm-test.inc                |  100 ++-----
 sysdeps/i386/fpu/libm-test-ulps   |  574 +++++++++++++++++++++++++++++++++++
 sysdeps/x86_64/fpu/libm-test-ulps |  592 +++++++++++++++++++++++++++++++++++++
 4 files changed, 1222 insertions(+), 74 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/16315] Bad overflowing pow results for directed rounding
  2013-12-11  1:00 [Bug math/16315] New: Bad overflowing pow results for directed rounding jsm28 at gcc dot gnu.org
  2013-12-11  1:22 ` [Bug math/16315] " jsm28 at gcc dot gnu.org
  2014-03-21  0:04 ` cvs-commit at gcc dot gnu.org
@ 2014-06-13 11:25 ` fweimer at redhat dot com
  2014-06-23 20:14 ` jsm28 at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 11:25 UTC (permalink / raw)
  To: glibc-bugs

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

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/16315] Bad overflowing pow results for directed rounding
  2013-12-11  1:00 [Bug math/16315] New: Bad overflowing pow results for directed rounding jsm28 at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-06-23 20:14 ` jsm28 at gcc dot gnu.org
@ 2014-06-23 20:14 ` cvs-commit at gcc dot gnu.org
  2014-06-29 11:50 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-06-23 20:14 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #3 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  4da6db51880289f0bf41b39e05cf9bb1c4769c47 (commit)
      from  5686b236cccdc8c72788b7996537ed92ac3a3c8c (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=4da6db51880289f0bf41b39e05cf9bb1c4769c47

commit 4da6db51880289f0bf41b39e05cf9bb1c4769c47
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Mon Jun 23 20:12:33 2014 +0000

    Fix pow overflow in non-default rounding modes (bug 16315).

    This patch fixes bug 16315, bad pow handling of overflow/underflow in
    non-default rounding modes.  Tests of pow are duly converted to
    ALL_RM_TEST to run all tests in all rounding modes.

    There are two main issues here.  First, various implementations
    compute a negative result by negating a positive result, but this
    yields inappropriate overflow / underflow values for directed
    rounding, so either overflow / underflow results need recomputing in
    the correct sign, or the relevant overflowing / underflowing operation
    needs to be made to have a result of the correct sign.  Second, the
    dbl-64 implementation sets FE_TONEAREST internally; in the overflow /
    underflow case, the result needs recomputing in the original rounding
    mode.

    Tested x86_64 and x86 and ulps updated accordingly.

        [BZ #16315]
        * sysdeps/i386/fpu/e_pow.S (__ieee754_pow): Ensure possibly
        overflowing or underflowing operations take place with sign of
        result.
        * sysdeps/i386/fpu/e_powf.S (__ieee754_powf): Likewise.
        * sysdeps/i386/fpu/e_powl.S (__ieee754_powl): Likewise.
        * sysdeps/ieee754/dbl-64/e_pow.c: Include <math.h>.
        (__ieee754_pow): Recompute overflowing and underflowing results in
        original rounding mode.
        * sysdeps/x86/fpu/powl_helper.c: Include <stdbool.h>.
        (__powl_helper): Allow negative argument X and scale negated value
        as needed.  Avoid passing value outside [-1, 1] to f2xm1.
        * sysdeps/x86_64/fpu/e_powl.S (__ieee754_powl): Ensure possibly
        overflowing or underflowing operations take place with sign of
        result.
        * sysdeps/x86_64/fpu/multiarch/e_pow.c [HAVE_FMA4_SUPPORT]:
        Include <math.h>.
        * math/auto-libm-test-in: Add more tests of pow.
        * math/auto-libm-test-out: Regenerated.
        * math/libm-test.inc (pow_test): Use ALL_RM_TEST.
        (pow_tonearest_test_data): Remove.
        (pow_test_tonearest): Likewise.
        (pow_towardzero_test_data): Likewise.
        (pow_test_towardzero): Likewise.
        (pow_downward_test_data): Likewise.
        (pow_test_downward): Likewise.
        (pow_upward_test_data): Likewise.
        (pow_test_upward): Likewise.
        (main): Don't call removed functions.
        * sysdeps/i386/fpu/libm-test-ulps: Update.
        * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

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

Summary of changes:
 ChangeLog                            |   34 +
 NEWS                                 |   22 +-
 math/auto-libm-test-in               |   65 +
 math/auto-libm-test-out              | 2670 ++++++++++++++++++++++++++++++++++
 math/libm-test.inc                   |   68 +-
 sysdeps/i386/fpu/e_pow.S             |   50 +-
 sysdeps/i386/fpu/e_powf.S            |   12 +-
 sysdeps/i386/fpu/e_powl.S            |   78 +-
 sysdeps/i386/fpu/libm-test-ulps      |    8 +-
 sysdeps/ieee754/dbl-64/e_pow.c       |   61 +-
 sysdeps/x86/fpu/powl_helper.c        |   32 +-
 sysdeps/x86_64/fpu/e_powl.S          |   71 +-
 sysdeps/x86_64/fpu/libm-test-ulps    |   14 +-
 sysdeps/x86_64/fpu/multiarch/e_pow.c |    1 +
 14 files changed, 2953 insertions(+), 233 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/16315] Bad overflowing pow results for directed rounding
  2013-12-11  1:00 [Bug math/16315] New: Bad overflowing pow results for directed rounding jsm28 at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-06-13 11:25 ` fweimer at redhat dot com
@ 2014-06-23 20:14 ` jsm28 at gcc dot gnu.org
  2014-06-23 20:14 ` cvs-commit at gcc dot gnu.org
  2014-06-29 11:50 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2014-06-23 20:14 UTC (permalink / raw)
  To: glibc-bugs

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

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 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/16315] Bad overflowing pow results for directed rounding
  2013-12-11  1:00 [Bug math/16315] New: Bad overflowing pow results for directed rounding jsm28 at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-06-23 20:14 ` cvs-commit at gcc dot gnu.org
@ 2014-06-29 11:50 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-06-29 11:50 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #5 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  edea402804bce917cfd7cd1af76212e6364c23db (commit)
      from  dd0ba018122e88937a5f14b6594b9a40693b2e58 (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=edea402804bce917cfd7cd1af76212e6364c23db

commit edea402804bce917cfd7cd1af76212e6364c23db
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Sun Jun 29 11:49:08 2014 +0000

    Fix ldbl-128 powl sign of result in overflow / underflow cases (bug 17097).

    This patch fixes bug 17097, ldbl-128 powl producing overflowing /
    underflowing results with positive sign when the result should have
    been negative.  This was shown up by the tests in non-default rounding
    modes added by my patch for bug 16315, but isn't actually limited to
    non-default rounding modes: rather, when rounding to nearest the
    wrappers produced a result with the correct sign and so always hid the
    bug unless -lieee was used to disable the wrappers.  The problem is
    that in the cases where Y is large enough that the result overflows or
    underflows for X not very close to 1, but not large enough to overflow
    or underflow for all X != +/- 1 (in the latter case Y is always an
    even integer), a positive overflowing / underflowing result is always
    returned, rather than one with the correct sign.  This patch moves the
    relevant part of computation of the sign earlier and returns a result
    of the correct sign.

    Tested for mips64.

        [BZ #17097]
        * sysdeps/ieee754/ldbl-128/e_powl.c (__ieee754_powl): Return
        result with correct sign in case of exponents that produce
        overflow except for X very close to 1.

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

Summary of changes:
 ChangeLog                         |    7 +++++++
 NEWS                              |    2 +-
 sysdeps/ieee754/ldbl-128/e_powl.c |   26 +++++++++++++-------------
 3 files changed, 21 insertions(+), 14 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

end of thread, other threads:[~2014-06-29 11:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-11  1:00 [Bug math/16315] New: Bad overflowing pow results for directed rounding jsm28 at gcc dot gnu.org
2013-12-11  1:22 ` [Bug math/16315] " jsm28 at gcc dot gnu.org
2014-03-21  0:04 ` cvs-commit at gcc dot gnu.org
2014-06-13 11:25 ` fweimer at redhat dot com
2014-06-23 20:14 ` jsm28 at gcc dot gnu.org
2014-06-23 20:14 ` cvs-commit at gcc dot gnu.org
2014-06-29 11:50 ` cvs-commit 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).