Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)
atof(3) Guardian Native C Library Calls Reference Manual
setlocale() function.
NOTES
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 atof() 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 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 floating-point value without causing
underflow or overflow).
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 specification when used for IEEE floating-point
format data.
The return of an errno value is an extension to the XPG4 Version 2 specification.
1−26 Hewlett-Packard Company 527192-007