wcstod(3C)
wcstod, wcstof, wcstold --
convert wide string to floating point value
Synopsis
#include <wchar.h>
double wcstod(const wchar_t *nptr, wchar_t **endptr);
float wcstof(const wchar_t *nptr, wchar_t **endptr);
long double wcstold(const wchar_t *nptr, wchar_t **endptr);
Description
wcstod returns, as a double-precision floating-point number, the
wide character string pointed to by nptr.
wcstof returns, as a single-precision floating-point number, the
wide character string pointed to by nptr.
wcstold returns, as a long double-precision floating-point number, the
wide character string pointed to by nptr.
Scanning occurs up to the first wide character that is unrecognized.
The function recognizes an optional string that is composed of "white space"
wide characters as defined by the iswspace function.
The string is then followed by an optional sign then a sequence of
digits optionally containing a decimal point character, followed by an
exponential part (e or E) then another optional sign with
an integer following it.
Also, instead of the regular decimal digit sequence, the string can be
a hexadecimal floating value, an infinity, or a NaN.
A hexadecimal floating value consists of 0x or OX
followed by a sequence of hexadecimal digits optionally containing a
decimal point character, followed by a binary exponent part p or P
then an optional sign with an integer following it.
The exponent part must be present if no decimal point character
is present.
An infinity is specified by the string inf or infinity
case insensitive.
A NaN is specified by nan case insensitive,
followed by an optional sequence of zero or more alphanumeric or
underscore _ characters between a pair of parenthesis.
If the value of endptr is not null, a pointer to the wide character
terminating the scan is returned in the location pointed to by endptr.
Return values
The function returns the value produced after the conversion process.
If the function has not been performed then zero is returned and
errno may be set to EINVAL.
If a correct value causes overflow, ±HUGE_VAL is returned,
depending on the sign of the value, and errno is set to ERANGE.
If the value produced is correct but causes underflow, then zero will be
returned with errno being set to ERANGE.
Errors
In the following conditions, these functions may fail and
set errno to:
ERANGE-
The value produced after the conversion process would cause either an
overflow or underflow.
EINVAL-
No conversion process could be carried out.
Usage
Zero and ±HUGE_VAL can be returned as a correct value after the
conversion process.
However, they can also be returned on error.
To check for an error condition, zero should be assigned
to errno followed by a call to one of these functions
and then a check on errno.
If the value of errno is non-zero it can be assumed that an error
has occurred.
References
fscanf(3S),
localeconv(3C),
setlocale(3C),
wchar(5),
wcstol(3C)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004