|
|
HP-UX Reference Volume 4 of 5 > sstrtod(3C) |
|
NAMEstrtod, atof — convert string to double-precision number SYNOPSIS#include <stdlib.h> double strtod(const char *str, char **ptr); double atof(const char *str); DESCRIPTIONstrtod() returns, as a double-precision floating-point number, the value represented by the character string pointed to by str. The string is scanned (leading white-space characters as defined by isspace() in ctype(3C) are ignored) up to the first unrecognized character. If no conversion can take place, zero is returned. strtod() recognizes characters in the following sequence:
The radix character is determined by the loaded NLS environment (see setlocale(3C)). If setlocale() has not been called successfully, the default NLS environment, "C", is used (see lang(5)). 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). RETURN VALUEIf the correct value would cause overflow, +HUGE_VAL or -HUGE_VAL 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. When the input parameter character string for strtod() and atof() is either inf (case insensitive) or infinity (case insensitive) strtod() and atof() will return HUGE_VAL. When the input parameter character string for strtod() and atof() is nan (case insensitive), strtod() and atof() will return _DNANQ. |
|