long doublewcstold(const wchar_t *nptr,wchar_t **endptr) ;
Return Type : long double
A floating-point type with extended precision, typically larger than `double` and used for high-precision arithmetic. The size and precision depend on the platform but are often 80 or 128 bits.
A pointer to a read-only wide-character string, where each character is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets, such as Unicode. The string is null-terminated, with the terminator being a `wchar_t` with value 0.
1st Parameter
Pointer to the null-terminated wide-character string to be converted.
Pointer to a pointer to a wide character. It is set to the character in `nptr` where the conversion stopped.
Read more about parameters of wcstold in parameters section
The wcstoldfunction in C language Converts the initial portion of a wide character string to a long double.
wcstold converts the initial portion of the wide-character string pointed to by nptr to a long double representation. It's similar to wcstod, but returns a long double instead of a double, providing higher precision for floating-point numbers.
The wcstoldfunction takes 2
parameters:
•
const wchar_t * `nptr`: Pointer to the null-terminated wide-character string to be converted.
•
wchar_t ** `endptr`: Pointer to a pointer to a wide character. It is set to the character in `nptr` where the conversion stopped.
Converts the initial part of the wide-character string `nptr` to a `long double` value. If `endptr` is not `NULL`, it points to the first character after the number that was converted.
The wcstold function return value :
Returns the converted long double value
If no conversion could be performed, 0
0 is returned
If the correct value is outside the range of representable values, ±HUGE_VALL is returned with the proper sign, and errno is set to ERANGE
Output
This example demonstrates the basic usage of wcstold to convert a wide string to a long double value, showing its high precision capability.