wcstof(), wcstod(), wcstold(), wcstof_l(), wcstod_l(), wcstold_l()

convert wide character string to various floating point value 

Function


SYNOPSIS

#include <wchar.h>

float wcstof(const wchar_t *nptr, wchar_t **endptr);

double wcstod(const wchar_t *nptr, wchar_t **endptr);

long double wcstold(const wchar_t *nptr, wchar_t **endptr);

float wcstof_l(const wchar_t *nptr, wchar_t **endptr, locale_t locale);

double wcstod_l(const wchar_t *nptr, wchar_t **endptr, locale_t locale);

long double wcstold_l(const wchar_t *nptr, wchar_t **endptr, locale_t locale);


DESCRIPTION

The wcstod() function converts the input string nptr into a double-precision value. The scanning stops at the first character that is not recognized as part of the number. This character can be the terminating NULL. This conversion occurs if a string of the expected form is passed in. The expected form consists of an initial, possibly empty, sequence of white-space characters, a sequence of characters interpreted as a floating-point constant, and a final sequence of wide characters that are not recognized as part followed by a terminating NULL character.

The sequence of characters that is interpreted as a floating-point constant must be of the following form. The expected form begins with an optional + or - character followed by a non-empty sequence of digits followed by an optional radix and an optional exponent part. The exponent part consists of an e or E followed by an optional sign and one or more digits.

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

The strtod_l() class of functions behave in the same way as strtod() class of functions without the _l suffix, but uses the specified locale rather than the global or per-thread locale. A locale_t is returned by newlocale().


PARAMETERS

nptr 

Is the null-terminated pointer to convert.

endptr 

Points to the character that stops the scan.

locale

Is a locale_t perhaps returned by newlocale() or LC_GLOBAL_LOCALE or 0 for the current thread locale set with uselocale().


RETURN VALUES

The wcstod() and wcstod_l() class of functions return the value of the floating-point number. In the case of an overflow the wcstod() and wcstod_l() functions returns ±HUGE_VAL (or ±HUGE_VALF or ±HUGE_VALL), where the sign of HUGE_VAL matches the sign of the value that could not be represented. If no conversion can be performed or if an underflow occurred then the wcstod() and wcstod_l() functions return 0. If the function fails, errno is set to one of the following values:

ERANGE 

An overflow occurred.

EINVAL 

The conversion could not be performed or an underflow occurred.


CONFORMANCE

wcstod() conforms to ANSI/ISO 9899-1990/AM 1-1995.


MULTITHREAD SAFETY LEVEL

MT-Safe, with exceptions.

The wcstod() class of functions are MT-Safe as long as no thread calls setlocale() while this function is executing.

The wcstod_l() class of functions are MT-Safe as long as no thread calls freelocale() on localewhile this function is executing.


PORTING ISSUES

None.


AVAILABILITY

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


SEE ALSO

Functions:
newlocale(), setlocale(), wcstoimax(), wcstoimax_l(), wcstol(), wcstol_l(), wcstoll(), wcstoll_l(), wcstoq(), wcstoul(), wcstoul_l(), wcstoull(), wcstoull_l(), wcstoumax(), wcstoumax_l(), wcstouq()


PTC MKS Toolkit 10.4 Documentation Build 39.