This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix strtod handling of underflow (bug 14047)
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 30 Oct 2012 16:37:25 -0700
- Subject: Re: Fix strtod handling of underflow (bug 14047)
- References: <Pine.LNX.4.64.1210291817060.31481@digraph.polyomino.org.uk>
On Mon, Oct 29, 2012 at 11:19 AM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> Bug 14047 reports that strtod/strtof/strtold wrongly treat exact
> underflow cases as underflow, setting errno to ERANGE, although for
> most purposes only inexact underflow should be treated as underflow.
>
> This patch fixes these functions not to set errno to ERANGE in this
> case, to detect underflow correctly using each architecture's rules
> for determining tininess of binary floating-point results (as given in
> <http://sourceware.org/ml/libc-alpha/2012-09/msg00633.html> and
> followups) and to raise the underflow flag on underflow. (Nothing is
> done about signaling the underflow exception without raising the flag
> on inexact underflow cases, so as to get a trap when traps on
> underflow are enabled; there's no change there from the previous
> state, which didn't signal the exception on underflow, exact or
> inexact, at all. It may make sense to wait for the later parts of the
> draft C floating-point TS to be available before doing much on
> alternate exception handling for standard library functions.)
>
> Tested x86 and x86_64, and stdlib/ tests on powerpc to cover a case of
> a "before rounding" tininess detection architecture.
>
> 2012-10-29 Joseph Myers <joseph@codesourcery.com>
>
> [BZ #14047]
> * sysdeps/generic/tininess.h: New file.
> * sysdeps/i386/tininess.h: Likewise.
> * sysdeps/sh/tininess.h: Likewise.
> * sysdeps/x86_64/tininess.h: Likewise.
Any particular reason to have both sysdeps/i386/tininess.h and
sysdeps/x86_64/tininess.h? Will sysdeps/x86/tininess.h work
here?
--
H.J.