Newsgroups: comp.std.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: Plauger & Brodie strtod description
Message-ID: <1989Dec30.222937.29304@utzoo.uucp>
Organization: U of Toronto Zoology
References: <1294@quintus.UUCP>
Date: Sat, 30 Dec 89 22:29:37 GMT

In article <1294@quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes:
>The railroad diagram on page 163 of "Standard C" by Plauger & Brodie
>suggests that the string argument of strtod() must contain either a
>decimal point or an exponent, so that strtod("1234", (char**)NULL)
>must return 0.0 if called in the "C" locale.  This requirement matches
>the syntax of floating-point constants in C, but it is more restrictive
>than current versions of strtod(), which accept "1234".
>
>Q1: have Plauger & Brodie got it right?

P&B have goofed.  The description of strtod in the draft (well, the
Oct 88 draft, the one I've got) specifies that both decimal point and
exponent are optional, and explicitly assigns a meaning to the case
where neither is present.  For a guess, P&B copied the diagram from
the floating-point-constant one and overlooked the fine print.
-- 
1972: Saturn V #15 flight-ready|     Henry Spencer at U of Toronto Zoology
1989: birds nesting in engines | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
