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

OSS Library Calls (s) strtof(3)
NAME
strtof - Converts a character string to a floating-point value
LIBRARY
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>
float strtof(
const char *nptr,
char **endptr
);
PARAMETERS
nptr Points to the character string to be converted.
endptr Points to a pointer in which the strtof( ) function stores the position in the string
specified by the nptr parameter where an invalid character is found.
DESCRIPTION
The strtof( ) function converts the initial portion of the string pointed to by the nptr parameter to
a floating-point value. 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 an optional + (plus) or - (minus) sign,
followed by one of these:
A nonempty sequence of decimal digits optionally containing a radix (decimal-point)
character, then an optional exponent part, which consists of e or E, followed by an
optional + (plus sign) or - (minus sign), followed by one or more decimal digits.
A 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
radix (decimal-point) character, then an optional binary exponent part, which consists of
p or P, followed by an optional + (plus sign) or - (minus sign), followed by one or more
decimal digits.
For IEEE floating-point values only, one of INF, INFINITY, NAN, or NAN(seq), where
seq is a sequence of digit and nondigit characters.
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.
527187-017 Hewlett-Packard Company 6175