Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

atof(3) OSS Library Calls Reference Manual
NAME
atof - Converts a character string to a double-precision floating-point value
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <stdlib.h>
double atof(
const char *nptr);
PARAMETERS
nptr Points to the character string to be converted.
DESCRIPTION
The atof( ) function converts the string pointed to by the nptr parameter to a double oating-
point value up to the first character that is inconsistent with the format of a floating-point number.
Leading white-space characters are ignored. A call to this function is equivalent to a call to
strtod(nptr, (char ∗∗) NULL), except for error handling. When the value cannot be represented,
the result is undefined.
The atof( ) function converts the initial portion of the string pointed to by the nptr parameter to
double representation. First the input string is decomposed into the following three parts:
An initial, possibly empty, sequence of white-space characters (as specified by the
isspace( ) function for programs in the C/POSIX locale and the iswspace( ) function for
programs in other locales).
A subject sequence interpreted as a floating-point constant.
A final string of one or more unrecognized characters, including the terminating null byte
of the input string.
After decomposition of the string, the subject sequence is converted to a floating-point number,
and the resulting value is returned. A subject sequence is defined as the longest initial subse-
quence of the input string, starting with the first non-white-space character, that is of the
expected form. The expected form and order of the subject sequence is as follows:
1. An optional + (plus) or - (minus) sign.
2. A sequence of digits optionally containing a radix character.
3. An optional exponent part, consisting of e or E, followed by an optional sign, which is
followed by one or more decimal digits.
When the input string is empty or consists entirely of white space, or when the first non-white-
space character is not a sign, a digit, or a radix character, the subject sequence contains no char-
acters.
In the TNS environment, the atof( ) function supports only the C/POSIX locale. In the native
environment, all locales are supported.
The setlocale( ) function might affect the radix character used in the conversion result. The radix
character is controlled by the LC_NUMERIC category of the setlocale( ) function.
150 Hewlett-Packard Company 527187-017