Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)

atof(3) Guardian Native C Library Calls Reference Manual
NOTES
This function supports both IEEE Std 754-1985 oating-point and Tandem oating-point values
in the native environment. IEEE values can include NaN and innity, 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 oating-point formats. Refer to the Guar-
dian Programmers Guide for a discussion of oating-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 oating-point value.
When a correct return value would cause overow, a properly signed HUGE_VAL (Inf)is
returned. On underow, a properly signed 0.0 (zero) is returned.
Upon successful completion, the atof() function returns the converted oating-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 atof()
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 occur, the atof() 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 oating-point value without causing underow or overow).
RELATED INFORMATION
Functions: atoi(3), fp_class(3), isnan(3), isspace(3), iswspace(3), scanf(3), setlocale(3),
strtod(3).
STANDARDS CONFORMANCE
This function conforms to the XPG4 Version 2 specication when used for IEEE oating-point
format data.
The return of an errno value is an extension to the XPG4 Version 2 specication.
122 Hewlett-Packard Company 527192-005