This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/23961] powf can overflow to inf without setting errno in non-nearest rounding mode


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

--- 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  505b5b292293a5d6bd4046a6bc7f8c2381a33da4 (commit)
      from  304c61a24f909168c16793ccf7c686237e53d003 (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=505b5b292293a5d6bd4046a6bc7f8c2381a33da4

commit 505b5b292293a5d6bd4046a6bc7f8c2381a33da4
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Mon Dec 10 11:08:36 2018 +0000

    Fix powf overflow handling in non-nearest rounding mode [BZ #23961]

    The threshold value at which powf overflows depends on the rounding mode
    and the current check did not take this into account. So when the result
    was rounded away from zero it could become infinity without setting
    errno to ERANGE.

    Example: pow(0x1.7ac7cp+5, 23) is 0x1.fffffep+127 + 0.1633ulp

    If the result goes above 0x1.fffffep+127 + 0.5ulp then errno is set,
    which is fine in nearest rounding mode, but

      powf(0x1.7ac7cp+5, 23) is inf in upward rounding mode
      powf(-0x1.7ac7cp+5, 23) is -inf in downward rounding mode

    and the previous implementation did not set errno in these cases.

    The fix tries to avoid affecting the common code path or calling a
    function that may introduce a stack frame, so float arithmetics is used
    to check the rounding mode and the threshold is selected accordingly.

        [BZ #23961]
        * math/auto-libm-test-in: Add new test case.
        * math/auto-libm-test-out-pow: Regenerated.
        * sysdeps/ieee754/flt-32/e_powf.c (__powf): Fix overflow check.

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

Summary of changes:
 ChangeLog                       |    7 +++++
 math/auto-libm-test-in          |    2 +
 math/auto-libm-test-out-pow     |   50 +++++++++++++++++++++++++++++++++++++++
 sysdeps/ieee754/flt-32/e_powf.c |   12 +++++++++
 4 files changed, 71 insertions(+), 0 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]