WCSTOD(3) NEWLIB WCSTOD(3)NAME
2.40 `wcstod', `wcstof'--wide char string to double or float
SYNOPSIS
#include <stdlib.h>
double wcstod(const wchar_t *STR, wchar_t **TAIL);
float wcstof(const wchar_t *STR, wchar_t **TAIL);
double _wcstod_r(void *REENT,
const wchar_t *STR, wchar_t **TAIL);
float _wcstof_r(void *REENT,
const wchar_t *STR, wchar_t **TAIL);
DESCRIPTION
The function `wcstod' parses the wide character string STR, producing a
substring which can be converted to a double value. The substring con‐
verted is the longest initial subsequence of STR, beginning with the
first non-whitespace character, that has one of these formats:
[+|-]DIGITS[.[DIGITS]][(e|E)[+|-]DIGITS]
[+|-].DIGITS[(e|E)[+|-]DIGITS]
[+|-](i|I)(n|N)(f|F)[(i|I)(n|N)(i|I)(t|T)(y|Y)]
[+|-](n|N)(a|A)(n|N)[<(>[HEXDIGITS]<)>]
[+|-]0(x|X)HEXDIGITS[.[HEXDIGITS]][(p|P)[+|-]DIGITS]
[+|-]0(x|X).HEXDIGITS[(p|P)[+|-]DIGITS]
The substring contains no characters if STR is empty, consists
entirely of whitespace, or if the first non-whitespace character is
something other than `+', `-', `.', or a digit, and cannot be parsed as
infinity or NaN. If the platform does not support NaN, then NaN is
treated as an empty substring. If the substring is empty, no conver‐
sion is done, and the value of STR is stored in `*TAIL'. Otherwise,
the substring is converted, and a pointer to the final string (which
will contain at least the terminating null character of STR) is stored
in `*TAIL'. If you want no assignment to `*TAIL', pass a null pointer
as TAIL. `wcstof' is identical to `wcstod' except for its return type.
This implementation returns the nearest machine number to the input
decimal string. Ties are broken by using the IEEE round-even rule.
However, `wcstof' is currently subject to double rounding errors.
The alternate functions `_wcstod_r' and `_wcstof_r' are reentrant
versions of `wcstod' and `wcstof', respectively. The extra argument
REENT is a pointer to a reentrancy structure.
RETURNS
Return the converted substring value, if any. If no conversion could
be performed, 0 is returned. If the correct value is out of the range
of representable values, plus or minus `HUGE_VAL' is returned, and
`ERANGE' is stored in errno. If the correct value would cause under‐
flow, 0 is returned and `ERANGE' is stored in errno.
Supporting OS subroutines required: `close', `fstat', `isatty',
`lseek', `read', `sbrk', `write'.
SEE ALSOwcstod is part of the library. The full documentation for is main‐
tained as a Texinfo manual. If info and are properly installed at your
site, the command
info
will give you access to the complete manual.
NEWLIB April 2010 WCSTOD(3)