public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "adhemerval.zanella at linaro dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug math/27460] hypot(__DBL_DENORM_MIN__, -0.) incorrectly raises FE_INEXACT and FE_UNDERFLOW
Date: Tue, 23 Feb 2021 20:13:25 +0000	[thread overview]
Message-ID: <bug-27460-131-E4wQaqahWW@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-27460-131@http.sourceware.org/bugzilla/>

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

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg

--- Comment #1 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Afaik since we define __STDC_IEC_559__ POSIX allows the implementation to
return an error range [1].  This is in fact what the fix for BZ#18803 does,
where it explicit raise underflow exception when the result is tiny and
inexact.

I think we are in fact missing a underflow check for the case where second
argument is '0':

diff --git a/sysdeps/ieee754/dbl-64/e_hypot.c
b/sysdeps/ieee754/dbl-64/e_hypot.c
index 9ec4c1ced0..bcd172130e 100644
--- a/sysdeps/ieee754/dbl-64/e_hypot.c
+++ b/sysdeps/ieee754/dbl-64/e_hypot.c
@@ -100,7 +100,10 @@ __ieee754_hypot (double x, double y)
          uint32_t low;
          GET_LOW_WORD (low, b);
          if ((hb | low) == 0)
-           return a;
+           {
+             math_check_force_underflow (x);
+             return a;
+           }
          t1 = 0;
          SET_HIGH_WORD (t1, 0x7fd00000);       /* t1=2^1022 */
          b *= t1;


[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/hypot.html

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

  parent reply	other threads:[~2021-02-23 20:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 16:07 [Bug math/27460] New: " 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27460-131-E4wQaqahWW@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).