strtod()

convert string to double precision value 

Function


SYNOPSIS

#include <stdlib.h>

double strtod(const char *nptr, char **endptr);


DESCRIPTION

The strtod() function converts the string pointed by nptr to double representation. This function recognizes (in order) an optional string of spaces, an optional sign, a string of digits optionally containing a radix character, an optional 'e' or 'E', and then an optionally signed integer. The first unrecognized character ends the string. A pointer to this unrecognized character is stored in the object addressed by endptr, if endptr is not NULL.

The radix character for strtod() is that defined by the last successful call to setlocale(), category LC_NUMERIC. If setlocale(), category LC_NUMERIC, has not been called successfully, or if the radix is not defined for a supported language, the radix character is defined as a period (.).


PARAMETERS

nptr 

Points to a character string for strtod() to convert.

endptr 

Is a result parameter that, if not NULL, is loaded with the address of the first character that strtod() does not attempt to convert.


RETURN VALUES

The strtod() function returns the converted value, if there is any. If no conversion could be performed, strtod() returns zero. If the correct value is outside the range of representable values (plus or minus), strtod() returns HUGE_VAL (according to the sign of the value) and sets errno to ERANGE. If the correct value causes underflow, strtod() returns zero and sets errno to ERANGE.


CONFORMANCE

ANSI/ISO 9899-1990.


MULTITHREAD SAFETY LEVEL

MT-Safe, with exceptions.

This function is MT-Safe as long as no thread calls setlocale() while this function is executing.


PORTING ISSUES

None.


AVAILABILITY

MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
atof(), setlocale(), strtol(), strtoul()


MKS Toolkit 9.2 Documentation Build 16.