Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Jun 2003 02:04:19 -0700
From:      David Schultz <das@FreeBSD.org>
To:        src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/lib/libc/stdio vfscanf.c
Message-ID:  <20030628090418.GA30292@HAL9000.homeunix.com>
In-Reply-To: <200306280903.h5S936Em045685@repoman.freebsd.org>
References:  <200306280903.h5S936Em045685@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jun 28, 2003, David Schultz wrote:
> das         2003/06/28 02:03:05 PDT
> 
>   FreeBSD src repository
> 
>   Modified files:
>     lib/libc/stdio       vfscanf.c 
>   Log:
>   Revamp scanf's floating-point-parsing algorithm to support
>   [+|-]Inf, [+|-]NaN, nan(...), and hexidecimal FP constants.
>   While here, add %a and %A, which are aliases for %e, and
>   add support for long doubles.

The new code should correctly parse any well-formed floating point
number, but if you notice any problems, set (extern int) scanfdebug
to 1.  This will cause scanf() to dump core if it notices that
strtod() disagrees with it about how long the number is.  The two
are known to disagree in exactly one case, namely, the 'nan(...)'
form.  POSIX allows any alphanumeric string to appear in the
parentheses, but strtod() only accepts hexadecimal as it should.
Fortunately, we get correct behavior anyway, since the interpretation
of such a sequence is implementation-defined.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030628090418.GA30292>