Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

Guardian Native C Library Calls (t - z) wcstod(3)
entirely of white-space, wide-character codes, or if the first non-white-space, wide-character
code is not a sign, a digit, or a radix character.
If the subject sequence is valid, the sequence of wide-character codes, starting with the first digit
or radix character, whichever occurs first, is interpreted as a floating-point or double-precision,
floating-point constant. The locales radix character is treated as equivalent to the . (dot) within
floating-point constants in the C locale. If neither an exponent or radix character appears, a radix
character is assumed to follow the last digit in the wide-character string. If the subject sequence
begins with a - (minus sign), the conversion value is negated. The radix character is determined
by the LC_NUMERIC category in the program’s current locale. In the C locale, or in a locale
where the radix character is not defined, the radix character defaults to a . (dot).
The wcstod() function stores a pointer to the final wide-character segment of the string, starting
with the first invalid character, in the object pointed to by the endptr parameter, unless the endptr
parameter is a null pointer.
NOTES
This function supports both IEEE Std 754-1985 floating-point and Tandem floating-point values
in the native environment. If the value is in IEEE floating-point format, the sign of 0.0 (zero) can
be either positive or negative.
Refer to the fp_class(3) reference page for a description of IEEE value classes.
Guardian functions are available to convert between floating-point formats. Refer to the Guar-
dian Programmers Guide for a discussion of floating-point conversions.
RETURN VALUES
The wcstod() function returns the converted value if a valid floating-point constant is found. If
no conversion could be performed, a value of 0.0 (zero) is returned and errno is set to [EIN-
VAL].
If the converted value is outside the range (either too high or too low), the variable errno is set to
[ERANGE]. In case of overflow, plus or minus HUGE_VAL is returned. In the case of
underflow, a value of 0.0 (zero) is returned. If the subject sequence is empty or does not have the
expected form, no conversion is performed. In this case, the value specified by the ws parameter
is stored in the object pointed to by the endptr parameter, provided that the endptr parameter is
not a null pointer.
Because the wcstod() function returns 0.0 (zero) or HUGE_VAL in the event of an error and
these values are also valid return values if the wcstod() function is successful, applications
should set errno to 0 (zero) before calling the wcstod() function and then check errno after
return from the function. If errno is nonzero, an error occurred. Additionally, if 0.0 (zero) is
returned, applications should check whether the endptr parameter equals the nptr parameter. In
this case, there was no valid subject string.
ERRORS
If the following condition occurs, the wcstod() function sets errno to the corresponding value:
[EINVAL] The converted value is an invalid numerical form.
[ERANGE] The converted value is outside the range of representable values.
RELATED INFORMATION
Functions: atof(3), fp_class(3), isnan(3), iswalnum(3), localeconv(3), scanf(3), setlocale(3),
wcstol(3).
527192-018 Hewlett-Packard Company 7155