public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Jeff Johnston <jjohnstn@redhat.com>
To: Keith Packard <keithp@keithp.com>
Cc: Joseph Myers <joseph@codesourcery.com>, Newlib <newlib@sourceware.org>
Subject: Re: [PATCH] stdlib: Make strtod/strtof set ERANGE consistently for underflow.
Date: Mon, 28 Jun 2021 16:38:39 -0400	[thread overview]
Message-ID: <CAOox84tLhL86b=RF7OkoNs9WmoBy-AfB1mOS9dC-1WpiY94b3g@mail.gmail.com> (raw)
In-Reply-To: <874kdppp5w.fsf@keithp.com>

Hi Joseph,

While I realize that glibc does things differently and there are cases
still not handled, do you object to merging Keith's patch as-is?  If not,
I'll push it.

-- Jeff J.

On Tue, Jun 22, 2021 at 5:26 PM Keith Packard <keithp@keithp.com> wrote:

> Joseph Myers <joseph@codesourcery.com> writes:
>
> >> This matches glibc behavior, as well as the Linux, Mac OS X, OpenBSD,
> >> FreeBSD and SunOS strtod man pages.
>
> (I should have said 'matches glibc in all of my tests, which are not
> exhaustive' :-)
>
> > What glibc does is set it when the IEEE underflow exception flag is
> > raised.  That is, when the result is tiny and inexact, where "tiny"
> > follows each architecture's choice of before-rounding or after-rounding
> > tininess detection (neither of which means "the rounded result is
> > subnormal"; for both definitions of tiny results, there are values that
> > round to the least-magnitude normal value of their sign but are still
> > considered tiny, because after-rounding actually means "the result would
> > have a subnormal exponent if rounded to the same precision as for normal
> > values but with a wider exponent range").
>
> Thanks for this clarification; I didn't realize that underflow had this
> additional subtly. It sounds like this means that there are additional
> cases where errno should be set to ERANGE in the code. I'm afraid I
> don't understand the workings of this function well enough to know how
> to detect this particular case. Could we somehow detect this using
> exceptions? Or are there places in the code which could add some direct
> checks?
>
> --
> -keith
>

  parent reply	other threads:[~2021-06-28 20:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 17:48 Keith Packard
2021-06-22 20:31 ` Joseph Myers
2021-06-22 21:25   ` Keith Packard
2021-06-23 16:19     ` Joseph Myers
2021-06-28 20:38     ` Jeff Johnston [this message]
2021-06-28 20:44       ` Joseph Myers
2021-07-07 17:22 ` Jeff Johnston

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='CAOox84tLhL86b=RF7OkoNs9WmoBy-AfB1mOS9dC-1WpiY94b3g@mail.gmail.com' \
    --to=jjohnstn@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=keithp@keithp.com \
    --cc=newlib@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).