public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/15918] New: Unnecessary check for equality in hypotf()
@ 2013-09-01 21:37 pipping at exherbo dot org
  2013-09-02  4:09 ` [Bug libc/15918] " bugdal at aerifal dot cx
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: pipping at exherbo dot org @ 2013-09-01 21:37 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 15918
           Summary: Unnecessary check for equality in hypotf()
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: pipping at exherbo dot org
                CC: drepper.fsp at gmail dot com

The file

  sysdeps / ieee754 / flt-32 / e_hypotf.c

contains the lines

  31             if (x == y)
  32               return fabsf(y);
  33             return fabsf(x);

  37             if (x == y)
  38               return fabsf(x);
  39             return fabsf(y);

as of revision 8f499b5fdeb40ff4861a5b35dbbb3ecf6161c9c0. Obviously, the former
chunk is equivalent to

  fabsf(x);

and the latter chunk is equivalent to

  fabsf(y);

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


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

* [Bug libc/15918] Unnecessary check for equality in hypotf()
  2013-09-01 21:37 [Bug libc/15918] New: Unnecessary check for equality in hypotf() pipping at exherbo dot org
@ 2013-09-02  4:09 ` bugdal at aerifal dot cx
  2013-09-02  9:23 ` pipping at exherbo dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bugdal at aerifal dot cx @ 2013-09-02  4:09 UTC (permalink / raw)
  To: glibc-bugs

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

Rich Felker <bugdal at aerifal dot cx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugdal at aerifal dot cx

--- Comment #1 from Rich Felker <bugdal at aerifal dot cx> ---
Nothing is "obvious" in floating point. In this case I think you are likely
correct that the code is redundant, but in general, in the presence of things
like NANs and negative zeros, "obvious" is often "wrong".

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


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

* [Bug libc/15918] Unnecessary check for equality in hypotf()
  2013-09-01 21:37 [Bug libc/15918] New: Unnecessary check for equality in hypotf() pipping at exherbo dot org
  2013-09-02  4:09 ` [Bug libc/15918] " bugdal at aerifal dot cx
@ 2013-09-02  9:23 ` pipping at exherbo dot org
  2013-09-02 13:51 ` bugdal at aerifal dot cx
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pipping at exherbo dot org @ 2013-09-02  9:23 UTC (permalink / raw)
  To: glibc-bugs

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

Elias Pipping <pipping at exherbo dot org> changed:

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

--- Comment #3 from Elias Pipping <pipping at exherbo dot org> ---
Ouch, I fell into a trap. Sorry for wasting everyone's time.

Could you maybe add a comment to that, in my humble opinion,
very misleading section of the code?

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


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

* [Bug libc/15918] Unnecessary check for equality in hypotf()
  2013-09-01 21:37 [Bug libc/15918] New: Unnecessary check for equality in hypotf() pipping at exherbo dot org
  2013-09-02  4:09 ` [Bug libc/15918] " bugdal at aerifal dot cx
  2013-09-02  9:23 ` pipping at exherbo dot org
@ 2013-09-02 13:51 ` bugdal at aerifal dot cx
  2014-02-07  2:59 ` [Bug math/15918] " jsm28 at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bugdal at aerifal dot cx @ 2013-09-02 13:51 UTC (permalink / raw)
  To: glibc-bugs

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

Rich Felker <bugdal at aerifal dot cx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #4 from Rich Felker <bugdal at aerifal dot cx> ---
Andreas, in the case of hypot(NAN,INFINITY), (ha == 0x7f800000) is false, so
that branch won't be taken, and (hb == 0x7f800000) is true, but in that case,
fabs(y) gives the right value no matter what the value of x is. I think the
original bug report is likely correct. It's just not as "obvious" as the
reporter considered it.

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


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

* [Bug math/15918] Unnecessary check for equality in hypotf()
  2013-09-01 21:37 [Bug libc/15918] New: Unnecessary check for equality in hypotf() pipping at exherbo dot org
                   ` (2 preceding siblings ...)
  2013-09-02 13:51 ` bugdal at aerifal dot cx
@ 2014-02-07  2:59 ` jsm28 at gcc dot gnu.org
  2014-06-13 12:58 ` fweimer at redhat dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2014-02-07  2:59 UTC (permalink / raw)
  To: glibc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libc                        |math
           Severity|normal                      |enhancement

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


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

* [Bug math/15918] Unnecessary check for equality in hypotf()
  2013-09-01 21:37 [Bug libc/15918] New: Unnecessary check for equality in hypotf() pipping at exherbo dot org
                   ` (3 preceding siblings ...)
  2014-02-07  2:59 ` [Bug math/15918] " jsm28 at gcc dot gnu.org
@ 2014-06-13 12:58 ` fweimer at redhat dot com
  2015-09-15 17:25 ` jsm28 at gcc dot gnu.org
  2015-09-15 17:25 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 12:58 UTC (permalink / raw)
  To: glibc-bugs

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

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] 8+ messages in thread

* [Bug math/15918] Unnecessary check for equality in hypotf()
  2013-09-01 21:37 [Bug libc/15918] New: Unnecessary check for equality in hypotf() pipping at exherbo dot org
                   ` (5 preceding siblings ...)
  2015-09-15 17:25 ` jsm28 at gcc dot gnu.org
@ 2015-09-15 17:25 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-09-15 17:25 UTC (permalink / raw)
  To: glibc-bugs

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

--- 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  694aabefd2eb3a0e2c5624d7feb1d7310b2bdd8b (commit)
      from  828bf6828b048b1482e95f84ca92e5fe0edcdc0c (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=694aabefd2eb3a0e2c5624d7feb1d7310b2bdd8b

commit 694aabefd2eb3a0e2c5624d7feb1d7310b2bdd8b
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Tue Sep 15 17:24:23 2015 +0000

    Simplify hypotf infinity handling (bug 15918).

    Bug 15918 points out that the handling of infinities in hypotf can be
    simplified: it's enough to return the absolute value of the infinite
    argument without first comparing it to the other argument and possibly
    returning that other argument's absolute value.  This patch makes that
    cleanup (which should not change how hypotf behaves on any input).

    Tested for x86_64.

        [BZ #15918]
        * sysdeps/ieee754/flt-32/e_hypotf.c (__ieee754_hypotf): Simplify
        handling of cases where one argument is an infinity.

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

Summary of changes:
 ChangeLog                         |    4 ++++
 NEWS                              |   12 ++++++------
 sysdeps/ieee754/flt-32/e_hypotf.c |   12 ++----------
 3 files changed, 12 insertions(+), 16 deletions(-)

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


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

* [Bug math/15918] Unnecessary check for equality in hypotf()
  2013-09-01 21:37 [Bug libc/15918] New: Unnecessary check for equality in hypotf() pipping at exherbo dot org
                   ` (4 preceding siblings ...)
  2014-06-13 12:58 ` fweimer at redhat dot com
@ 2015-09-15 17:25 ` jsm28 at gcc dot gnu.org
  2015-09-15 17:25 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2015-09-15 17:25 UTC (permalink / raw)
  To: glibc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |2.23

--- Comment #6 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] 8+ messages in thread

end of thread, other threads:[~2015-09-15 17:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-01 21:37 [Bug libc/15918] New: Unnecessary check for equality in hypotf() pipping at exherbo dot org
2013-09-02  4:09 ` [Bug libc/15918] " bugdal at aerifal dot cx
2013-09-02  9:23 ` pipping at exherbo dot org
2013-09-02 13:51 ` bugdal at aerifal dot cx
2014-02-07  2:59 ` [Bug math/15918] " jsm28 at gcc dot gnu.org
2014-06-13 12:58 ` fweimer at redhat dot com
2015-09-15 17:25 ` jsm28 at gcc dot gnu.org
2015-09-15 17:25 ` 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).