public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/19134] New: [powerpc32] lround, lroundf spurious exceptions
@ 2015-10-14 19:56 jsm28 at gcc dot gnu.org
2015-10-14 21:15 ` [Bug math/19134] " cvs-commit at gcc dot gnu.org
2015-10-14 21:16 ` jsm28 at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2015-10-14 19:56 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=19134
Bug ID: 19134
Summary: [powerpc32] lround, lroundf spurious exceptions
Product: glibc
Version: 2.22
Status: NEW
Severity: normal
Priority: P2
Component: math
Assignee: unassigned at sourceware dot org
Reporter: jsm28 at gcc dot gnu.org
Target Milestone: ---
Host: powerpc*-*-*
The powerpc32 implementations of lround and lroundf can produce spurious
exceptions from adding 0.5 then converting to integer. For example, for float:
Failure: lround (max_value): Exception "Inexact" set
Failure: lround (-max_value): Exception "Inexact" set
Failure: lround (0x1p63): Exception "Inexact" set
Failure: lround (0x1p64): Exception "Inexact" set
Failure: lround (0x1p65): Exception "Inexact" set
Failure: lround (-0x1p31): Exception "Inexact" set
Failure: lround (-0x1p63): Exception "Inexact" set
Failure: lround (-0x1p64): Exception "Inexact" set
Failure: lround (-0x1p65): Exception "Inexact" set
Failure: lround (0x7fffff80p0): Exception "Inexact" set
Failure: lround (0x7fffff8000000000p0): Exception "Inexact" set
Failure: lround (-0x8000010000000000p0): Exception "Inexact" set
Failure: lround (2097151.0): Exception "Inexact" set
Failure: lround (8388608.0): Exception "Inexact" set
Failure: lround (16777216.0): Exception "Inexact" set
Failure: lround (0x1.fffffep+23): Exception "Inexact" set
Failure: lround (-0x1.fffffep+23): Exception "Inexact" set
Failure: lround (0x1.000002p+23): Exception "Inexact" set
Failure: lround (-0x1.000002p+23): Exception "Inexact" set
Failure: lround (0x1.fffffep+23): Exception "Inexact" set
Failure: lround (-0x1.fffffep+23): Exception "Inexact" set
For double, spurious "overflow" exceptions can occur as well as "inexact".
Failure: lround_upward (max_value): Exception "Overflow" set
--
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/19134] [powerpc32] lround, lroundf spurious exceptions
2015-10-14 19:56 [Bug math/19134] New: [powerpc32] lround, lroundf spurious exceptions jsm28 at gcc dot gnu.org
@ 2015-10-14 21:15 ` cvs-commit at gcc dot gnu.org
2015-10-14 21:16 ` jsm28 at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-10-14 21:15 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=19134
--- 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 0c25f5b5bb48a9d550b5fb403b9a801ba04c146f (commit)
from 1fae5a6800b07d0a8225664ac65a628bbe98cae7 (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=0c25f5b5bb48a9d550b5fb403b9a801ba04c146f
commit 0c25f5b5bb48a9d550b5fb403b9a801ba04c146f
Author: Joseph Myers <joseph@codesourcery.com>
Date: Wed Oct 14 21:13:42 2015 +0000
Fix powerpc32 lround, lroundf spurious exceptions (bug 19134).
The powerpc32 implementation of lround and lroundf can produce
spurious exceptions from adding 0.5 then converting to integer. This
includes "inexact" from the conversion to integer (not allowed for
integer arguments to these functions), and, for larger integer
arguments, "inexact", and "overflow" when rounding upward, from the
addition. In addition, "inexact" is not allowed together with
"invalid" and so inexact addition must be avoided when the integer
will be out of range of 32-bit long, whether or not the argument is an
integer.
This patch fixes these problems. As in the powerpc64 llround
implementation, a check is added for too-large arguments; in the
powerpc64 case that means arguments at least 2^52 in magnitude (so
that 0.5 cannot be added exactly), while in this case it means
arguments for which the result would overflow "long". In those cases
a suitable overflowing value is used for the integer conversion
without adding 0.5, while for smaller arguments it's tested whether
the argument is an integer (by adding and subtracting 2^52 to the
absolute value and comparing with the original absolute value) to
avoid adding 0.5 to integers and generating spurious "inexact".
This code is not used when the power5+ sysdeps directories are used,
as there's a separate power5+ version of these functions..
Tested for powerpc. This gets test-float (for a default powerpc32
hard-float build without any --with-cpu) back to the point where it
should pass once powerpc ulps are regenerated; test-double still needs
another problem with exceptions fixed to get back to that point (and I
haven't looked lately at what default powerpc64 results are like).
[BZ #19134]
* sysdeps/powerpc/powerpc32/fpu/s_lround.S (.LC1): New object.
(.LC2): Likewise.
(.LC3): Likewise.
(__lround): Do not add 0.5 to integer or out-of-range arguments.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 8 +++++
NEWS | 2 +-
sysdeps/powerpc/powerpc32/fpu/s_lround.S | 43 ++++++++++++++++++++++++++++-
3 files changed, 50 insertions(+), 3 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/19134] [powerpc32] lround, lroundf spurious exceptions
2015-10-14 19:56 [Bug math/19134] New: [powerpc32] lround, lroundf spurious exceptions jsm28 at gcc dot gnu.org
2015-10-14 21:15 ` [Bug math/19134] " cvs-commit at gcc dot gnu.org
@ 2015-10-14 21:16 ` jsm28 at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2015-10-14 21:16 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=19134
Joseph Myers <jsm28 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |2.23
--- Comment #2 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
Fixed for 2.23.
--
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-10-14 21:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-14 19:56 [Bug math/19134] New: [powerpc32] lround, lroundf spurious exceptions jsm28 at gcc dot gnu.org
2015-10-14 21:15 ` [Bug math/19134] " cvs-commit at gcc dot gnu.org
2015-10-14 21:16 ` 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).