Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > W

wcstod(3C)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

wcstod(), wcstof(), wcstold() — convert a wide character string to a double-precision number

SYNOPSIS

#include <wchar.h>

double wcstod(const wchar_t *__restrict nptr, wchar_t **__restrict endptr);

long double wcstold(const wchar_t *__restrict nptr, wchar_t **__restrict endptr);

Itanium(R)-based Systems Only

float wcstof(const wchar_t *restrict nptr, wchar_t **restrict endptr);

Remarks

These functions are compliant with the UNIX standard Worldwide Portability Interface wide-character formatting functions. They parallel the 8-bit character formatting functions defined in strtod(3C), strtold(3C) and strtof(3C) respectively.

DESCRIPTION

The wcstod(), wcstof(), and wcstold() functions return the value represented by the wide-character string pointed to by nptr as a double-precision floating-point number, single-precision floating-point number, and long double-precision number, respectively. The wide character string is scanned (leading white-space characters as defined by iswspace() in wctype(3C) are ignored) up to the first unrecognized character. If no conversion can take place, zero is returned.

The wcstod(), wcstof(), and wcstold() functions recognize wide characters in the following sequence:

1.

An optional string of white space wide characters, which are ignored

2.

An optional sign followed by one of the following:

  • A string of digits optionally containing a radix character, then an optional e or E followed by an optional sign or space, followed by an integer

  • A 0x or 0X, then a non-empty sequence of hexadecimal digits optionally containing a radix character, then an optional binary exponent part

  • One of INF or INFINITY, or any other wide string equivalent except for case

  • One of NAN or NAN(n-wchar-sequence), or any other wide string ignoring case in the NAN part, where n-wchar-sequence is:

    • digit

    • nondigit

    • n-wchar-sequence digit

    • n-wchar-sequence nondigit

The radix character is determined by the current NLS environment (see setlocale(3C)). If setlocale() has not been called successfully, the default NLS environment, "C", is used (see lang(5)). The default environment specifies a period (.) as the radix character.

If the value of endptr is not (wchar_t **)NULL, the variable to which it points is set to point at the wide character after the last number, if any, that was recognized. If no number can be formed, *endptr is set to nptr, and zero is returned.

EXTERNAL INFLUENCES

Environment Variables

LC_NUMERIC determines the value of the radix character within the currently loaded NLS environment.

LC_CTYPE determines how wide character codes are interpreted.

International Code Set Support

Single- and multibyte character code sets are supported.

RETURN VALUE

If the correct value would cause overflow, +HUGE_VAL or -HUGE_VAL 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.

If wcstod() encounters an input wide character string equal to inf or infinity (both case insensitive) it will return HUGE_VAL. If wcstod() encounters an input wide character string equal to nan or NAN(n-wchar-sequence) (both case insensitive) it will return _DNANQ.

AUTHOR

wcstod() was developed by AT&T and HP. wcstof() and wcstold() were developed by HP.

STANDARDS CONFORMANCE

wcstod(): XPG4

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.