up | Inhaltsverzeichniss | Kommentar

Manual page for STRTOD(3)

strtod, atof - convert string to double-precision number

SYNOPSIS

double strtod(str, ptr)
char *str, **ptr;

double atof(str) char *str;

DESCRIPTION

strtod() returns as a double-precision floating-point number the value represented by the character string pointed to by str. The string is scanned up to the first unrecognized character, using string_to_decimal.3 with fortran_conventions set to 0.

If the value of ptr is not (char **)NULL, a pointer to the character terminating the scan is returned in the location pointed to by ptr. If no number can be formed, *ptr is set to str, and for historical compatibility, 0.0 is returned, although a NaN would better match the IEEE Floating-Point Standard's intent.

The radix character is defined by the program's locale (category LC_NUMERIC). In the "C" locale, or in a locale where the radix character is not defined. the radix character defaults to a period `.'.

atof(str) is equivalent to strtod(str, (char **)NULL). Thus, when atof(str) returns 0.0 there is no way to determine whether str contained a valid numerical string representing 0.0 or an invalid numerical string.

SEE ALSO

scanf.3v string_to_decimal.3

DIAGNOSTICS

Exponent overflow and underflow produce the results specified by the IEEE Standard. In addition, errno is set to ERANGE.


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97