Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ wcstod(3C) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

iswspace(3C)

localeconv(3C)

setlocale(3C)

wcstol(3C)

scanf(3S)

wchar(5)

wcstod(3C)                                                       wcstod(3C)

NAME
     wcstod - convert wide character string to double-precision number

SYNOPSIS
     #include <wchar.h>

     double wcstod(const wchart *nptr, wchart **endptr);

DESCRIPTION
     The wcstod() function converts the initial portion of the wide charac-
     ter string pointed to by nptr to double representation. First it
     decomposes the input wide character string into three parts: an ini-
     tial, possibly empty, sequence of white-space wide character codes (as
     specified by the iswspace() function); a subject sequence interpreted
     as a floating-point constant; and a final wide character string of one
     or more unrecognized wide character codes, including the terminate
     null wide character code of the input wide character string. Then it
     attempts to convert the subject sequence to a floating-point number,
     and returns the result.

     The expected form of the subject sequence is an optional + or - sign,
     then a non-empty sequence of digits optionally containing a radix,
     then an optional exponent part. An exponent part consists of e or E,
     followed by an optional sign, followed by one or more decimal digits.
     The subject sequence is defined as the longest initial subsequence of
     the input wide character string, starting with the first non-white-
     space wide character code, that is of the expected form. The subject
     sequence contains no wide character codes if the input wide character
     string is empty or consists entirely of white-space wide character
     codes, or if the first wide character code that is not white space
     other than a sign, a digit or a radix.

     If the subject sequence has the expected form, the sequence of wide
     character codes starting with the first digit or the radix (whichever
     occurs first) is interpreted as a floating constant as defined in the
     C language, except that the radix is used in place of a period, and
     that if neither an exponent part nor a radix appears, a radix is
     assumed to follow the last digit in the wide character string. If the
     subject sequence begins with a minus sign, the value resulting from
     the conversion is negated. A pointer to the final wide character
     string is stored in the object pointed to by endptr, provided that
     endptr is not a null pointer.

     The radix is defined in the programs locale (category LSNUMERIC). In
     the POSIX locale, or in a locale where the radix is not defined, the
     radix defaults to a period (.).

     In other than POSIX locale, other implementation-dependent subject
     sequence forms may be accepted.






Page 1                       Reliant UNIX 5.44                Printed 11/98

wcstod(3C)                                                       wcstod(3C)

     If the subject sequence is empty or does not have the expected form,
     no conversion is performed; the value of nptr is stored in the object
     pointed to by endptr, provided that endptr is not a null pointer.

     Because zero is returned on error and is also a valid return on suc-
     cess, an application wishing to check for error situations should set
     errno to 0, then call wcstod(), then check errno and if it is non-
     zero, assume an error has occurred.

     The wcstod() function will fail if:

     ERANGE   The value to be returned would cause overflow or underflow.

RETURN VALUE
     The wcstod() function returns the converted value, if any. If no
     conversion could be performed, zero is returned.

     If the correct value is outside the range of representable values,
     HUGEVAL is returned (according to the sign of the value), and errno
     is set to ERANGE.

     If the correct value would cause underflow, zero is returned, and
     errno is set to ERANGE.

SEE ALSO
     iswspace(3C), localeconv(3C), setlocale(3C), wcstol(3C), scanf(3S),
     wchar(5).



























Page 2                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026