Print this page
11620 strtod man page typo equence
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man3c/wcstod.3c.man.txt
+++ new/usr/src/man/man3c/wcstod.3c.man.txt
1 1 WCSTOD(3C) Standard C Library Functions WCSTOD(3C)
2 2
3 3
4 4
5 5 NAME
6 6 wcstod, wcstof, wcstold, wstod, watof - convert wide character string
7 7 to floating-point number
8 8
9 9 SYNOPSIS
10 10 #include <wchar.h>
11 11
12 12 double wcstod(const wchar_t *restrict nptr,
13 13 wchar_t **restrict endptr);
14 14
15 15
16 16 float wcstof(const wchar_t *restrict nptr,
17 17 wchar_t **restrict endptr);
18 18
19 19
20 20 long double wcstold(const wchar_t *restrict nptr,
21 21 wchar_t **restrict endptr);
22 22
23 23
24 24 double wstod(const wchar_t *nptr, wchar_t **endptr);
25 25
26 26
27 27 double watof(wchar_t *nptr);
28 28
29 29
30 30 DESCRIPTION
31 31 The wcstod(), wcstof(), and wcstold() functions convert the initial
32 32 portion of the wide-character string pointed to by nptr to double,
33 33 float, and long double representation, respectively. They first
34 34 decompose the input wide-character string into three parts:
35 35
36 36 1. An initial, possibly empty, sequence of white-space wide-
37 37 character codes (as specified by iswspace(3C))
38 38
39 39 2. A subject sequence interpreted as a floating-point constant
40 40 or representing infinity or NaN
41 41
42 42 3. A final wide-character string of one or more unrecognized
43 43 wide-character codes, including the terminating null wide-
44 44 character code of the input wide-character string.
45 45
46 46
47 47 Then they attempt to convert the subject sequence to a floating-point
48 48 number, and return the result.
49 49
50 50
51 51 The expected form of the subject sequence is an optional plus or minus
52 52 sign, then one of the following:
53 53
54 54 o A non-empty sequence of decimal digits optionally containing
55 55 a radix character, then an optional exponent part
56 56
57 57 o A 0x or 0X, then a non-empty sequence of hexadecimal digits
58 58 optionally containing a radix character, then an optional
59 59 binary exponent part
60 60
61 61 o One of INF or INFINITY, or any other wide string equivalent
62 62 except for case
63 63
64 64 o One of NAN or NAN(n-wchar-sequence(opt)), or any other wide
65 65 string ignoring case in the NAN part, where:
↓ open down ↓ |
65 lines elided |
↑ open up ↑ |
66 66
67 67 n-wchar-sequence:
68 68 digit
69 69 nondigit
70 70 n-wchar-sequence digit
71 71 n-wchar-sequence nondigit
72 72
73 73
74 74
75 75 In default mode for wcstod(), only decimal, INF/INFINITY, and
76 - NAN/NAN(n-char-sequence) forms are recognized. In C99/SUSv3 mode,
76 + NAN/NAN(n-wchar-sequence) forms are recognized. In C99/SUSv3 mode,
77 77 hexadecimal strings are also recognized.
78 78
79 79
80 - In default mode for wcstod(), the n-char-sequence in the NAN(n-char-
81 - equence) form can contain any character except ')' (right parenthesis)
82 - or '\0' (null). In C99/SUSv3 mode, the n-char-sequence can contain
80 + In default mode for wcstod(), the n-wchar-sequence in the NAN(n-wchar-
81 + sequence) form can contain any character except ')' (right parenthesis)
82 + or '\0' (null). In C99/SUSv3 mode, the n-wchar-sequence can contain
83 83 only upper and lower case letters, digits, and '_' (underscore).
84 84
85 85
86 86 The wcstof() and wcstold() functions always function in
87 87 C99/SUSv3-conformant mode.
88 88
89 89
90 90 The subject sequence is defined as the longest initial subsequence of
91 91 the input wide string, starting with the first non-white-space wide
92 92 character, that is of the expected form. The subject sequence contains
93 93 no wide characters if the input wide string is not of the expected
94 94 form.
95 95
96 96
97 97 If the subject sequence has the expected form for a floating-point
98 98 number, the sequence of wide characters starting with the first digit
99 99 or the radix character (whichever occurs first) is interpreted as a
100 100 floating constant according to the rules of the C language, except that
101 101 the radix character is used in place of a period, and that if neither
102 102 an exponent part nor a radix character appears in a decimal floating-
103 103 point number, or if a binary exponent part does not appear in a
104 104 hexadecimal floating-point number, an exponent part of the appropriate
105 105 type with value zero is assumed to follow the last digit in the string.
106 106 If the subject sequence begins with a minus sign, the sequence is
107 107 interpreted as negated. A wide-character sequence INF or INFINITY is
108 108 interpreted as an infinity. A wide-character sequence NAN or NAN(n-
109 109 wchar-sequence(opt)) is interpreted as a quiet NaN. A pointer to the
110 110 final wide string is stored in the object pointed to by endptr,
111 111 provided that endptr is not a null pointer.
112 112
113 113
114 114 If the subject sequence has either the decimal or hexadecimal form, the
115 115 value resulting from the conversion is rounded correctly according to
116 116 the prevailing floating point rounding direction mode. The conversion
117 117 also raises floating point inexact, underflow, or overflow exceptions
118 118 as appropriate.
119 119
120 120
121 121 The radix character is defined in the program's locale (category
122 122 LC_NUMERIC). In the POSIX locale, or in a locale where the radix
123 123 character is not defined, the radix character defaults to a period
124 124 ('.').
125 125
126 126
127 127 If the subject sequence is empty or does not have the expected form, no
128 128 conversion is performed; the value of nptr is stored in the object
129 129 pointed to by endptr, provided that endptr is not a null pointer.
130 130
131 131
132 132 The wcstod() function does not change the setting of errno if
133 133 successful.
134 134
135 135
136 136 The wstod() function is identical to wcstod().
137 137
138 138
139 139 The watof(str) function is equivalent to wstod(nptr, (wchar_t **)NULL).
140 140
141 141 RETURN VALUES
142 142 Upon successful completion, these functions return the converted value.
143 143 If no conversion could be performed, 0 is returned.
144 144
145 145
146 146 If the correct value is outside the range of representable values,
147 147 +-HUGE_VAL, +-HUGE_VALF, or +-HUGE_VALL is returned (according to the
148 148 sign of the value), a floating point overflow exception is raised, and
149 149 errno is set to ERANGE.
150 150
151 151
152 152 If the correct value would cause an underflow, the correctly rounded
153 153 result (which may be normal, subnormal, or zero) is returned, a
154 154 floating point underflow exception is raised, and errno is set to
155 155 ERANGE.
156 156
157 157 ERRORS
158 158 The wcstod() and wstod() functions will fail if:
159 159
160 160 ERANGE
161 161 The value to be returned would cause overflow or underflow.
162 162
163 163
164 164
165 165 The wcstod() and wcstod() functions may fail if:
166 166
167 167 EINVAL
168 168 No conversion could be performed.
169 169
170 170
171 171 USAGE
172 172 Because 0 is returned on error and is also a valid return on success,
173 173 an application wishing to check for error situations should set errno
174 174 to 0 call wcstod(), wcstof(), wcstold(), or wstod(), then check errno
175 175 and if it is non-zero, assume an error has occurred.
176 176
177 177 ATTRIBUTES
178 178 See attributes(5) for descriptions of the following attributes:
179 179
180 180
181 181
182 182
183 183 +--------------------+-------------------------+
184 184 |ATTRIBUTE TYPE | ATTRIBUTE VALUE |
185 185 +--------------------+-------------------------+
186 186 |Interface Stability | wcstod(), wcstof(), and |
187 187 | | wcstold() are Standard. |
↓ open down ↓ |
95 lines elided |
↑ open up ↑ |
188 188 +--------------------+-------------------------+
189 189 |MT-Level | MT-Safe |
190 190 +--------------------+-------------------------+
191 191
192 192 SEE ALSO
193 193 iswspace(3C), localeconv(3C), scanf(3C), setlocale(3C), wcstol(3C),
194 194 attributes(5), standards(5)
195 195
196 196
197 197
198 - March 31, 2003 WCSTOD(3C)
198 + August 25, 2019 WCSTOD(3C)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX