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

Guardian Native C Library Calls (s) strtod(3)
NAME
strtod - Converts a character string to a double-precision
oating-point value
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
H-series OSS processes: /G/system/zdllnnn/zcrtldll
SYNOPSIS
#include <stdlib.h>
double strtod(
const char *nptr,
char **endptr
);
PARAMETERS
nptr Points to the character string to be converted.
endptr Points to a pointer in which the strtod() function stores the position in the string
specied by the nptr parameter where an invalid character is found.
DESCRIPTION
The strtod() function converts the initial portion of the string pointed to by the nptr parameter to
a double oating-point value. First the input string is decomposed into the following three parts:
An initial, possibly empty, sequence of white-space characters (as specied 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 oating-point constant.
A nal 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 oating-point number,
and the resulting value is returned. A subject sequence is dened as the longest initial subse-
quence of the input string, starting with the rst 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 rst non-white-
space character is not a sign, a digit, or a radix character, the subject sequence contains no char-
acters.
When the value of the endptr parameter is not (char**) NULL, a pointer to the character that
terminated the scan is stored at *endptr.
When a oating-point value cannot be formed, *endptr is set to nptr.
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.
527192-005 Hewlett-Packard Company 679