strtod also accepts NAN, NAN(xxx) and INF as legal values. Missing part taken from FreeBSD, except that the documentation ommited "INF" and mentioned only "INFINITY".
Index: strtod.3 =================================================================== RCS file: /cvs/src/lib/libc/stdlib/strtod.3,v retrieving revision 1.14 diff -u -p -r1.14 strtod.3 --- strtod.3 13 Sep 2008 22:48:45 -0000 1.14 +++ strtod.3 14 Sep 2012 10:10:39 -0000 @@ -87,7 +87,32 @@ or .Sq e , followed by an optional plus or minus sign, followed by a sequence of digits. .Pp -Leading whitespace characters in the string (as defined by the +Alternatively, if the portion of the string following the optional +plus or minus sign begins with +.Dq INF +or +.Dq NAN , +ignoring case, it is interpreted as an infinity or a quiet \*(Na, +respectively. +The syntax +.Dq Xo Pf NAN( Ar "s" ) Xc , +where +.Ar s +is an alphanumeric string, produces the same value as the call +.Fo nan +.Qq Ar s Ns +.Fc +(respectively, +.Fo nanf +.Qq Ar s Ns +.Fc +and +.Fo nanl +.Qq Ar s Ns +.Fc . ) +.Pp +In any of the above cases, leading whitespace characters in the +string (as defined by the .Xr isspace 3 function) are skipped. .Sh RETURN VALUES -- Michal Mazurek
