Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)
strtod(3) Guardian Native C Library Calls Reference Manual
NOTES
In the TNS environment, the strtod() function supports only the C/POSIX locale. In the native
environment, all locales are supported.
This function supports both IEEE Std 754-1985 floating-point and Tandem floating-point values
in the native environment. IEEE values can include NaN and infinity, and the sign of 0.0 (zero)
can be either positive or negative. Refer to the fp_class(3) reference page for a description of
IEEE value classes.
Guardian functions are available to convert between floating-point formats. Refer to the Guar-
dian Programmer’s Guide for a discussion of floating-point conversions.
RETURN VALUES
When the string pointed to by nptr is empty or begins with an unrecognized character, 0.0 (zero)
is returned as the floating-point value.
When a correct return value would cause overflow, a properly signed HUGE_VAL (INF)is
returned. On underflow, a properly signed 0.0 (zero) is returned.
Upon successful completion, the strtod() function returns the converted floating-point value.
Because a return value of 0.0 (zero) can represent either a valid conversion or an error, you
should use errno to check for possible errors. Set errno to a value of 0 before the call to the
strtod() function and then check it for a nonzero value after the call. If errno is nonzero, an
error has occurred.
ERRORS
If any of the following conditions occurs, the strtod() function sets errno to the corresponding
value:
[ERANGE] The input string is out of range (that is, the subject sequence cannot be converted
to a floating-point value without causing underflow or overflow).
RELATED INFORMATION
Functions: atof(3), atoi(3), fp_class(3), isnan(3), isspace(3), iswspace(3), scanf(3), setlocale(3).
STANDARDS CONFORMANCE
This function conforms to the XPG4 Version 2 specification when used for IEEE floating-point
format data.
6−84 Hewlett-Packard Company 527192-007