STRTOD(3) — NEWS-OS Programmer’s Manual
NAME
strtod, atof − convert string to double-precision number
SYNOPSIS
double strtod(str, ptr)
char ∗str, ∗∗ptr;
double atof(str)
char ∗str;
DESCRIPTION
strtod 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.
strtod recognizes an optional string of “white-space” characters (as defined by isspace in ctype(3)), 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, 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(3), scanf(3S), strtol(3).
DIAGNOSTICS
If the correct value would cause overflow, ±HUGE is returned (according to the sign of the value). If the correct value would cause underflow, zero is returned.
BUGS
errno is not set when overflow or underflow.
NEWS-OSRelease 4.1C