wcstold() — Convert a wide-character string to long double
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
C99 |
both | z/OS® V1R7 |
Format
#define _ISOC99_SOURCE
#include <wchar.h>
long double wcstold(const wchar_t *__restrict__ nptr,
wchar_t **__restrict__ endptr);
General description
wcstold() converts a wchar_t * floating-point number input string to a long double value. The parameter nptr points to a sequence of wide-characters that can be interpreted as a numerical long double value.
It decomposes the input wide-character string into three parts:
- An initial, possibly empty, sequence of white-space wide-character codes (as specified by iswspace()).
- A subject sequence resembling a floating-point constant, infinity, or NaN.
- A final wide-character string of one or more unrecognized wide-characters codes, including the terminating NULL wide-character of the input wide-character string.
The function then attempts to convert the subject string into the floating-point number, and returns the result.
The expected form of the subject sequence is an optional plus or minus sign, then one of the following:
- A non-empty sequence of decimal digits optionally containing a radix character, then an optional exponent. A radix character is the character that separates the integer part of a number from the fractional.
- A 0x or 0X, a non-empty sequence of hexadecimal digits optionally containing a radix character, then a base 2 decimal exponent part with a p or P as prefix, a plus or minus sign, then a sequence of at least one decimal digit. (Example [-]0xh.hhhhp+/-d). A radix character is the character that separates the integer part of a number from the fractional part.
- One INF or INFINITY, ignoring case.
- One NANQ or NANQ(n-char-sequence), ignoring case.
- One NANS or NANS(n-char-sequence), ignoring case.
- One NAN or NAN(n-char-sequence), ignoring case.
See the "scanf() Family of Formatted Input Functions" for a description of special infinity and NaN sequences recognized by z/OS formatted input functions in IEEE Binary Floating-Point mode. The pointer to the final wide-character string is stored in the object pointed to by endptr, provided that endptr is not a NULL pointer.
Returned value
If successful, wcstold() returns the converted value, if any. If no conversion could be performed, it returns 0.
The long double value is a hexadecimal floating-point or IEEE Binary Floating-Point format depending on the floating-point mode of the invoking thread. This function uses __isBFP() to determine the floating-point mode of the invoking thread.
If the correct value is outside the range of representable values, then +/-HUGE_VALL, according to the sign of the value, is returned and the value of the ERANGE macro is stored in errno.
Related information
- wchar.h
- __isBFP() — Determine application floating-point format
- wcstof() — Convert a wide-character string to float
- wcstod() — Convert wide-character string to a double floating-point
- wcstol() — Convert a wide-character string to a long integer
- wcstoul() — Convert a wide-character string to an unsigned long integer