| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 3: Basic Library Functions Oracle Solaris 11 Information Library |
enable_extended_FILE_stdio(3C)
posix_spawnattr_getschedparam(3C)
posix_spawnattr_getschedpolicy(3C)
posix_spawnattr_getsigdefault(3C)
posix_spawnattr_getsigignore_np(3C)
posix_spawnattr_getsigmask(3C)
posix_spawnattr_setschedparam(3C)
posix_spawnattr_setschedpolicy(3C)
posix_spawnattr_setsigdefault(3C)
posix_spawnattr_setsigignore_np(3C)
posix_spawnattr_setsigmask(3C)
posix_spawn_file_actions_addclose(3C)
posix_spawn_file_actions_addclosefrom_np(3C)
posix_spawn_file_actions_adddup2(3C)
posix_spawn_file_actions_addopen(3C)
posix_spawn_file_actions_destroy(3C)
posix_spawn_file_actions_init(3C)
pthread_attr_getdetachstate(3C)
pthread_attr_getinheritsched(3C)
pthread_attr_getschedparam(3C)
pthread_attr_getschedpolicy(3C)
pthread_attr_setdetachstate(3C)
pthread_attr_setinheritsched(3C)
pthread_attr_setschedparam(3C)
pthread_attr_setschedpolicy(3C)
pthread_barrierattr_destroy(3C)
pthread_barrierattr_getpshared(3C)
pthread_barrierattr_setpshared(3C)
pthread_condattr_getpshared(3C)
pthread_condattr_setpshared(3C)
pthread_cond_reltimedwait_np(3C)
pthread_key_create_once_np(3C)
pthread_mutexattr_getprioceiling(3C)
pthread_mutexattr_getprotocol(3C)
pthread_mutexattr_getpshared(3C)
pthread_mutexattr_getrobust(3C)
pthread_mutexattr_setprioceiling(3C)
pthread_mutexattr_setprotocol(3C)
pthread_mutexattr_setpshared(3C)
pthread_mutexattr_setrobust(3C)
pthread_mutex_getprioceiling(3C)
pthread_mutex_reltimedlock_np(3C)
pthread_mutex_setprioceiling(3C)
pthread_rwlockattr_destroy(3C)
pthread_rwlockattr_getpshared(3C)
pthread_rwlockattr_setpshared(3C)
pthread_rwlock_reltimedrdlock_np(3C)
pthread_rwlock_reltimedwrlock_np(3C)
pthread_rwlock_timedrdlock(3C)
pthread_rwlock_timedwrlock(3C)
rctlblk_get_enforced_value(3C)
- convert wide character string to floating-point number
#include <wchar.h>doublewcstod(const wchar_t *restrictnptr,wchar_t **restrictendptr);
floatwcstof(const wchar_t *restrictnptr,wchar_t **restrictendptr);
long doublewcstold(const wchar_t *restrictnptr,wchar_t **restrictendptr);
doublewstod(const wchar_t *nptr,wchar_t **endptr);
doublewatof(wchar_t *nptr);
Thewcstod(),wcstof(), andwcstold() functions convert the initial portion of thewide-character string pointed to bynptr todouble,float, andlong double representation, respectively.They first decompose the input wide-character string into three parts:
An initial, possibly empty, sequence of white-space wide-character codes (as specified byiswspace(3C))
A subject sequence interpreted as a floating-point constant or representing infinity or NaN
A final wide-character string of one or more unrecognized wide-character codes, including the terminating null wide–character code of the input wide-character string.
Then they attempt to convert the subject sequence to a floating-point number,and return the result.
The expected form of the subject sequence is an optional plus orminus sign, then one of the following:
A non-empty sequence of decimal digits optionally containing a radix character, then an optional exponent part
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-sequenceopt), or any other wide string ignoring case in the NAN part, where:
n-wchar-sequence: digit nondigit n-wchar-sequence digit n-wchar-sequence nondigit
In default mode forwcstod(), only decimal, INF/INFINITY, and NAN/NAN(n-char-sequence) forms arerecognized. In C99/SUSv3 mode, hexadecimal strings are also recognized.
In default mode forwcstod(), then-char-sequence in the NAN(n-char-equence) form cancontain any character except ')' (right parenthesis) or '\0' (null). InC99/SUSv3 mode, then-char-sequence can contain only upper and lower case letters, digits,and '_' (underscore).
Thewcstof() andwcstold() functions always function in C99/SUSv3-conformant mode.
The subject sequence is defined as the longest initial subsequence of theinput wide string, starting with the first non-white-space wide character, that isof the expected form. The subject sequence contains no wide characters ifthe input wide string is not of the expected form.
If the subject sequence has the expected form for a floating-point number,the sequence of wide characters starting with the first digit or theradix character (whichever occurs first) is interpreted as a floating constant accordingto the rules of the C language, except that the radix character isused in place of a period, and that if neither an exponentpart nor a radix character appears in a decimal floating-point number, orif a binary exponent part does not appear in a hexadecimal floating-pointnumber, an exponent part of the appropriate type with value zero isassumed to follow the last digit in the string. If the subject sequencebegins with a minus sign, the sequence is interpreted as negated. Awide-character sequence INF or INFINITY is interpreted as an infinity. A wide-charactersequence NAN or NAN(n-wchar-sequenceopt) is interpreted as a quiet NaN. A pointer tothe final wide string is stored in the object pointed to byendptr, provided thatendptr is not a null pointer.
If the subject sequence has either the decimal or hexadecimal form, thevalue resulting from the conversion is rounded correctly according to the prevailingfloating point rounding direction mode. The conversion also raises floating point inexact,underflow, or overflow exceptions as appropriate.
The radix character is defined in the program's locale (categoryLC_NUMERIC). Inthe POSIX locale, or in a locale where the radix character isnot defined, the radix character defaults to a period ('.').
If the subject sequence is empty or does not have the expectedform, no conversion is performed; the value ofnptr is storedin the object pointed to byendptr, provided thatendptr isnot a null pointer.
Thewcstod() function does not change the setting oferrno if successful.
Thewstod() function is identical towcstod().
Thewatof(str) function is equivalent towstod(nptr, (wchar_t **)NULL).
Upon successful completion, these functions return the converted value. If no conversioncould be performed,0 is returned.
If the correct value is outside the range of representable values,±HUGE_VAL,±HUGE_VALF, or±HUGE_VALL is returned (according to the sign of the value),a floating point overflow exception is raised, anderrno is set toERANGE.
If the correct value would cause an underflow, the correctly rounded result(which may be normal, subnormal, or zero) is returned, a floating pointunderflow exception is raised, anderrno is set toERANGE.
Thewcstod() andwstod() functions will fail if:
The value to be returned would cause overflow or underflow.
Thewcstod() andwcstod() functions may fail if:
No conversion could be performed.
Because 0 is returned on error and is also a valid returnon success, an application wishing to check for error situations should seterrno to 0 callwcstod(),wcstof(),wcstold(), orwstod(), then checkerrnoand if it is non-zero, assume an error has occurred.
Seeattributes(5) for descriptions of the following attributes:
|
iswspace(3C),localeconv(3C),scanf(3C),setlocale(3C),wcstol(3C),attributes(5),standards(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |