wcstod(3C) wcstod(3C)
NAME
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.
Copyright 1994 Novell, Inc. Page 1
wcstod(3C) wcstod(3C)
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)
Copyright 1994 Novell, Inc. Page 2