This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: [Bug: atof() can't parse "NaN"]
- From: jjohnstn <jjohnstn at redhat dot com>
- To: Christopher Faylor <cgf at alumni dot unh dot edu>
- Cc: newlib at sourceware dot org, Christopher Faylor <me at cgf dot cx>
- Date: Thu, 6 Jan 2005 17:55:40 -0500 (EST)
- Subject: Re: [Bug: atof() can't parse "NaN"]
The newlib strtod and subsequently atof implementation currently does
not support NANs. I am working presently on an enhancement. It is
mostly working, however, I need to tweak vfscanf and a few unit tests
are not matching glibc behavior.
I should have something by end of day or tomorrow.
-- Jeff J.
On Thu, 6 Jan 2005, Christopher Faylor wrote:
> ----- Forwarded message from Roger Leigh <roger.leigh@epictechnology.co.uk> -----
>
> From: Roger Leigh
> Subject: Bug: atof() can't parse "NaN"
> Date: Thu, 6 Jan 2005 16:07:11 +0000
>
> Hi folks,
>
> While fixing up glib-2.6.0 to build, I found a failure in the
> floating-point tests. This is seemingly because atof() is bust.
> This is a trivial example:
>
>
> /* for NAN and INFINITY */
> #define _ISOC99_SOURCE
>
> #include <assert.h>
> #include <string.h>
> #include <stdlib.h>
> #include <math.h>
> #include <ieeefp.h>
>
> int
> main ()
> {
> double our_nan;
>
> #ifdef NAN
> our_nan = NAN;
> #else
> /* Do this before any call to setlocale. */
> our_nan = atof ("NaN");
> #endif
> assert (isnan (our_nan));
>
> return 0;
> }
>
>
> When I run this (current net release) the assert fails, and it
> segfaults.
>
>
> Regards,
> Roger
>
>