STRTOD(S) UNIX System V STRTOD(S)
Name
strtod, atof - convert string to double-precision number
Syntax
double strtod (str, ptr)
char *str, **ptr;
double atof (str)
char *str;
Description
The strtod function returns as a double-precision floating-
point number the value represented by the character string
pointed to by str. The string is scanned up to the first
unrecognized character.
The strtod function recognizes an optional string of
``white-space'' characters (as defined by isspace in
ctype(S)), then an optional sign, then a string of digits
optionally containing a decimal point, then an optional e or
E followed by an optional sign or space, followed by an
integer.
If the value of ptr is not (char **)NULL, a pointer to the
character terminating the scan is returned in the location
pointed to by ptr. If no number can be formed, *ptr is set
to str, and zero is returned.
atof(str) is equivalent to strtod(str, (char **)NULL).
See Also
ctype(S), scanf(S), strtol(S)
Diagnostics
If the correct value would cause overflow, _HUGE (as defined
in <math.h>) is returned (according to the sign of the
value), and errno is set to ERANGE.
If the correct value would cause underflow, zero is returned
and errno is set to ERANGE.
Standards Conformance
atof is conformant with:
AT&T SVID Issue 2, Select Code 307-127;
The X/Open Portability Guide II of January 1987;
ANSI X3.159-198X C Language Draft Standard, May 13,
1988;
IEEE POSIX Std 1003.1-1988 with C Standard Language-
Dependent System Support;
and NIST FIPS 151-1.
strtod is conformant with:
AT&T SVID Issue 2, Select Code 307-127;
The X/Open Portability Guide II of January 1987;
and ANSI X3.159-198X C Language Draft Standard, May 13,
1988.
(printed 6/20/89)