public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/18346] New: ldbl-128 roundl incorrect for exponents in [31, 47]
@ 2015-04-28 16:13 jsm28 at gcc dot gnu.org
  2015-04-28 17:28 ` [Bug math/18346] " cvs-commit at gcc dot gnu.org
  2015-04-28 17:28 ` jsm28 at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2015-04-28 16:13 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 18346
           Summary: ldbl-128 roundl incorrect for exponents in [31, 47]
           Product: glibc
           Version: 2.21
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: jsm28 at gcc dot gnu.org
  Target Milestone: ---

The implementation of roundl for ldbl-128 involves undefined behavior for
arguments with exponents from 31 to 47 inclusive, from the shift:

      u_int64_t i = -1ULL >> (j0 - 48);

For example, on mips64, this means roundl (0xffffffffffff.8p0L) wrongly returns
its argument, which is not an integer.

This is GCC libquadmath bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65757
.

Working on a patch.

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug math/18346] ldbl-128 roundl incorrect for exponents in [31, 47]
  2015-04-28 16:13 [Bug math/18346] New: ldbl-128 roundl incorrect for exponents in [31, 47] jsm28 at gcc dot gnu.org
@ 2015-04-28 17:28 ` cvs-commit at gcc dot gnu.org
  2015-04-28 17:28 ` jsm28 at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-04-28 17:28 UTC (permalink / raw)
  To: glibc-bugs

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

--- 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  7d0b2575416aec2717e8665287d0ab77826a0ade (commit)
      from  fb4041ae532fd21a82618c2be09898ea8979dec5 (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=7d0b2575416aec2717e8665287d0ab77826a0ade

commit 7d0b2575416aec2717e8665287d0ab77826a0ade
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Tue Apr 28 17:27:02 2015 +0000

    Fix ldbl-128 roundl for exponents in [31, 47] (bug 18346).

    The implementation of roundl for ldbl-128 involves undefined behavior
    for arguments with exponents from 31 to 47 inclusive, from the shift:

          u_int64_t i = -1ULL >> (j0 - 48);

    For example, on mips64, this means roundl (0xffffffffffff.8p0L)
    wrongly returns its argument, which is not an integer.  A condition
    checking for exponents < 31 should actually be checking for exponents
    < 48, and this patch makes it do so.  (That condition is for whether
    the bit representing 0.5 is in the high 64-bit half of the
    floating-point number.  The value 31 might have arisen from an
    incorrect conversion of the ldbl-96 version to handle ldbl-128.)

    This was originally reported as a GCC libquadmath bug
    <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65757>.

    Tested for mips64; also tested for x86_64 and x86 to make sure the new
    tests pass there.

        [BZ #18346]
        * sysdeps/ieee754/ldbl-128/s_roundl.c (__roundl): Handle all
        exponents less than 48 as cases where high part of mantissa needs
        examining to determine whether argument is integral.
        * math/libm-test.inc (round_test_data): Add more tests.

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

Summary of changes:
 ChangeLog                           |    8 ++++++++
 NEWS                                |    2 +-
 math/libm-test.inc                  |   11 +++++++++++
 sysdeps/ieee754/ldbl-128/s_roundl.c |    2 +-
 4 files changed, 21 insertions(+), 2 deletions(-)

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug math/18346] ldbl-128 roundl incorrect for exponents in [31, 47]
  2015-04-28 16:13 [Bug math/18346] New: ldbl-128 roundl incorrect for exponents in [31, 47] jsm28 at gcc dot gnu.org
  2015-04-28 17:28 ` [Bug math/18346] " cvs-commit at gcc dot gnu.org
@ 2015-04-28 17:28 ` jsm28 at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2015-04-28 17:28 UTC (permalink / raw)
  To: glibc-bugs

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

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

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

--- Comment #2 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] 3+ messages in thread

end of thread, other threads:[~2015-04-28 17:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-28 16:13 [Bug math/18346] New: ldbl-128 roundl incorrect for exponents in [31, 47] jsm28 at gcc dot gnu.org
2015-04-28 17:28 ` [Bug math/18346] " cvs-commit at gcc dot gnu.org
2015-04-28 17:28 ` 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).