STRTOD(3C) — HP-UX
NAME
strtod, atof, nl_strtod, nl_atof − convert string to double-precision number
SYNOPSIS
double strtod (str, ptr)
char ∗str, ∗∗ptr;
double atof (str)
char ∗str;
double nl_strtod (str, ptr, langid)
char ∗str, ∗∗ptr;
int langid;
double nl_atof (str, langid)
char ∗str;
inl langid;
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(3C)), then an optional sign, then a string of digits optionally containing a radix character, then an optional e or E followed by an optional sign or space, followed by an integer. The radix character is determined by the loaded NLS environment (see nl_init(3C)). If nl_init has not been called successfully, the default NLS environment, "n-computer" (see langid(5)), is used. The default environment specifies a period (.) as the radix character.
If the value of ptr is not (char ∗∗)NULL, the variable to which it points is set to point at the character after the last number, if any, that was recognized. If no number can be formed, ∗ptr is set to str, and zero is returned.
Atof(str) is equivalent to strtod (str, (char ∗∗)NULL).
Nl_strtod and nl_atof are similar to the above routines, but first call langinit (see nl_init(3C)) to load the NLS environment specified by langid.
DIAGNOSTICS
If the correct value would cause overflow, ±HUGE is returned (according to the sign of the value), and errno is set to ERANGE. HUGE_VAL may be used instead of HUGE.
If the correct value would cause underflow, zero is returned and errno is set to ERANGE.
WARNINGS
Nl_strtod and nl_atof are provided for historical reasons only. Their use is not recommended. Use strtod and atof instead.
AUTHOR
Strtod was developed by AT&T and HP.
SEE ALSO
ctype(3C), nl_init(3C), scanf(3S), strtol(3C), hpnls(5), langid(5).
INTERNATIONAL SUPPORT
8-bit data.
Hewlett-Packard Company — May 11, 2021