This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix strtod handling of underflow (bug 14047)


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]