public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/27460] New: hypot(__DBL_DENORM_MIN__, -0.) incorrectly raises FE_INEXACT and FE_UNDERFLOW
@ 2021-02-23 16:07 kretz at kde dot org
  2021-02-23 16:07 ` [Bug math/27460] " kretz at kde dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: kretz at kde dot org @ 2021-02-23 16:07 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 27460
           Summary: hypot(__DBL_DENORM_MIN__, -0.) incorrectly raises
                    FE_INEXACT and FE_UNDERFLOW
           Product: glibc
           Version: 2.31
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: kretz at kde dot org
  Target Milestone: ---

Testcase (https://godbolt.org/z/b4Ko4Y):

#include <fenv.h>
#include <math.h>

int main()
{
    volatile double a = __DBL_DENORM_MIN__;
    volatile double c = -0.;
    feclearexcept(FE_ALL_EXCEPT);
    //c = hypot(a, c); // this argument order raises no exceptions
    c = hypot(c, a);
    return fetestexcept(FE_ALL_EXCEPT);
}

This program raises FE_INEXACT and FE_UNDERFLOW. Since one argument to hypot is
0 the result is exact: the absolute value of the other argument. If you switch
the argument order the program raises no floating-point exceptions.

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

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

end of thread, other threads:[~2021-04-08 10:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23 16:07 [Bug math/27460] New: hypot(__DBL_DENORM_MIN__, -0.) incorrectly raises FE_INEXACT and FE_UNDERFLOW kretz at kde dot org
2021-02-23 16:07 ` [Bug math/27460] " kretz at kde dot org
2021-02-23 20:13 ` adhemerval.zanella at linaro dot org
2021-02-23 20:20 ` kretz at kde dot org
2021-02-23 20:37 ` adhemerval.zanella at linaro dot org
2021-02-23 20:46 ` kretz at kde dot org
2021-02-23 20:54 ` joseph at codesourcery dot com
2021-02-23 21:06 ` kretz at kde dot org
2021-02-24 13:32 ` adhemerval.zanella at linaro dot org
2021-02-24 22:48 ` joseph at codesourcery dot com
2021-04-08  4:38 ` zimmerma+gcc at loria dot fr
2021-04-08 10:34 ` adhemerval.zanella at linaro dot 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).