Print this page
11620 strtod man page typo equence
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man3c/wcstod.3c
+++ new/usr/src/man/man3c/wcstod.3c
1 1 .\"
2 2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 3 .\" permission to reproduce portions of its copyrighted documentation.
4 4 .\" Original documentation from The Open Group can be obtained online at
5 5 .\" http://www.opengroup.org/bookstore/.
6 6 .\"
7 7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 8 .\" Group, have given us permission to reprint portions of their
9 9 .\" documentation.
10 10 .\"
11 11 .\" In the following statement, the phrase ``this text'' refers to portions
12 12 .\" of the system documentation.
13 13 .\"
14 14 .\" Portions of this text are reprinted and reproduced in electronic form
15 15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 16 .\" Standard for Information Technology -- Portable Operating System
17 17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 20 .\" between these versions and the original IEEE and The Open Group
21 21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 22 .\" document. The original Standard can be obtained online at
23 23 .\" http://www.opengroup.org/unix/online.html.
24 24 .\"
25 25 .\" This notice shall appear on any product containing this material.
26 26 .\"
27 27 .\" The contents of this file are subject to the terms of the
28 28 .\" Common Development and Distribution License (the "License").
29 29 .\" You may not use this file except in compliance with the License.
30 30 .\"
31 31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 32 .\" or http://www.opensolaris.org/os/licensing.
33 33 .\" See the License for the specific language governing permissions
34 34 .\" and limitations under the License.
35 35 .\"
↓ open down ↓ |
35 lines elided |
↑ open up ↑ |
36 36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 38 .\" If applicable, add the following below this CDDL HEADER, with the
39 39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 41 .\"
42 42 .\"
43 43 .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
44 44 .\" Portions Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved
45 45 .\"
46 -.TH WCSTOD 3C "Mar 31, 2003"
46 +.TH WCSTOD 3C "Aug 25, 2019"
47 47 .SH NAME
48 48 wcstod, wcstof, wcstold, wstod, watof \- convert wide character string to
49 49 floating-point number
50 50 .SH SYNOPSIS
51 -.LP
52 51 .nf
53 52 #include <wchar.h>
54 53
55 54 \fBdouble\fR \fBwcstod\fR(\fBconst wchar_t *restrict\fR \fInptr\fR,
56 55 \fBwchar_t **restrict\fR \fIendptr\fR);
57 56 .fi
58 57
59 58 .LP
60 59 .nf
61 60 \fBfloat\fR \fBwcstof\fR(\fBconst wchar_t *restrict\fR \fInptr\fR,
62 61 \fBwchar_t **restrict\fR \fIendptr\fR);
63 62 .fi
64 63
65 64 .LP
66 65 .nf
67 66 \fBlong double\fR \fBwcstold\fR(\fBconst wchar_t *restrict\fR \fInptr\fR,
68 67 \fBwchar_t **restrict\fR \fIendptr\fR);
69 68 .fi
70 69
71 70 .LP
↓ open down ↓ |
10 lines elided |
↑ open up ↑ |
72 71 .nf
73 72 \fBdouble\fR \fBwstod\fR(\fBconst wchar_t *\fR\fInptr\fR, \fBwchar_t **\fR\fIendptr\fR);
74 73 .fi
75 74
76 75 .LP
77 76 .nf
78 77 \fBdouble\fR \fBwatof\fR(\fBwchar_t *\fR\fInptr\fR);
79 78 .fi
80 79
81 80 .SH DESCRIPTION
82 -.sp
83 -.LP
84 81 The \fBwcstod()\fR, \fBwcstof()\fR, and \fBwcstold()\fR functions convert the
85 82 initial portion of the wide-character string pointed to by \fInptr\fR to
86 83 \fBdouble\fR, \fBfloat\fR, and \fBlong double\fR representation, respectively.
87 84 They first decompose the input wide-character string into three parts:
88 85 .RS +4
89 86 .TP
90 87 1.
91 88 An initial, possibly empty, sequence of white-space wide-character codes (as
92 89 specified by \fBiswspace\fR(3C))
93 90 .RE
94 91 .RS +4
95 92 .TP
96 93 2.
97 94 A subject sequence interpreted as a floating-point constant or representing
98 95 infinity or NaN
99 96 .RE
100 97 .RS +4
101 98 .TP
102 99 3.
103 100 A final wide-character string of one or more unrecognized wide-character
104 101 codes, including the terminating null wide-character code of the input
105 102 wide-character string.
106 103 .RE
107 104 .sp
108 105 .LP
109 106 Then they attempt to convert the subject sequence to a floating-point number,
110 107 and return the result.
111 108 .sp
112 109 .LP
113 110 The expected form of the subject sequence is an optional plus or minus sign,
114 111 then one of the following:
115 112 .RS +4
116 113 .TP
117 114 .ie t \(bu
118 115 .el o
119 116 A non-empty sequence of decimal digits optionally containing a radix character,
120 117 then an optional exponent part
121 118 .RE
122 119 .RS +4
123 120 .TP
124 121 .ie t \(bu
125 122 .el o
126 123 A 0x or 0X, then a non-empty sequence of hexadecimal digits optionally
127 124 containing a radix character, then an optional binary exponent part
128 125 .RE
129 126 .RS +4
130 127 .TP
131 128 .ie t \(bu
132 129 .el o
133 130 One of INF or INFINITY, or any other wide string equivalent except for case
134 131 .RE
135 132 .RS +4
136 133 .TP
137 134 .ie t \(bu
138 135 .el o
139 136 One of NAN or NAN(\fIn-wchar-sequence\fR(\fIopt\fR)), or any other wide string
140 137 ignoring case in the NAN part, where:
141 138 .sp
142 139 .in +2
143 140 .nf
144 141 n-wchar-sequence:
145 142 digit
↓ open down ↓ |
52 lines elided |
↑ open up ↑ |
146 143 nondigit
147 144 n-wchar-sequence digit
148 145 n-wchar-sequence nondigit
149 146 .fi
150 147 .in -2
151 148
152 149 .RE
153 150 .sp
154 151 .LP
155 152 In default mode for \fBwcstod()\fR, only decimal, INF/INFINITY, and
156 -NAN/NAN(\fIn-char-sequence\fR) forms are recognized. In C99/SUSv3 mode,
153 +NAN/NAN(\fIn-wchar-sequence\fR) forms are recognized. In C99/SUSv3 mode,
157 154 hexadecimal strings are also recognized.
158 155 .sp
159 156 .LP
160 -In default mode for \fBwcstod()\fR, the \fIn-char-sequence\fR in the
161 -NAN(\fIn-char-equence\fR) form can contain any character except ')' (right
162 -parenthesis) or '\e0' (null). In C99/SUSv3 mode, the \fIn-char-sequence\fR can
157 +In default mode for \fBwcstod()\fR, the \fIn-wchar-sequence\fR in the
158 +NAN(\fIn-wchar-sequence\fR) form can contain any character except ')' (right
159 +parenthesis) or '\e0' (null). In C99/SUSv3 mode, the \fIn-wchar-sequence\fR can
163 160 contain only upper and lower case letters, digits, and '_' (underscore).
164 161 .sp
165 162 .LP
166 163 The \fBwcstof()\fR and \fBwcstold()\fR functions always function in
167 164 C99/SUSv3-conformant mode.
168 165 .sp
169 166 .LP
170 167 The subject sequence is defined as the longest initial subsequence of the input
171 168 wide string, starting with the first non-white-space wide character, that is of
172 169 the expected form. The subject sequence contains no wide characters if the
173 170 input wide string is not of the expected form.
174 171 .sp
175 172 .LP
176 173 If the subject sequence has the expected form for a floating-point number, the
177 174 sequence of wide characters starting with the first digit or the radix
178 175 character (whichever occurs first) is interpreted as a floating constant
179 176 according to the rules of the C language, except that the radix character is
180 177 used in place of a period, and that if neither an exponent part nor a radix
181 178 character appears in a decimal floating-point number, or if a binary exponent
182 179 part does not appear in a hexadecimal floating-point number, an exponent part
183 180 of the appropriate type with value zero is assumed to follow the last digit in
184 181 the string. If the subject sequence begins with a minus sign, the sequence is
185 182 interpreted as negated. A wide-character sequence INF or INFINITY is
186 183 interpreted as an infinity. A wide-character sequence NAN or
187 184 NAN(\fIn-wchar-sequence\fR(\fIopt\fR)) is interpreted as a quiet NaN. A pointer
188 185 to the final wide string is stored in the object pointed to by \fIendptr\fR,
189 186 provided that \fIendptr\fR is not a null pointer.
190 187 .sp
191 188 .LP
192 189 If the subject sequence has either the decimal or hexadecimal form, the value
193 190 resulting from the conversion is rounded correctly according to the prevailing
194 191 floating point rounding direction mode. The conversion also raises floating
195 192 point inexact, underflow, or overflow exceptions as appropriate.
196 193 .sp
197 194 .LP
198 195 The radix character is defined in the program's locale (category
199 196 \fBLC_NUMERIC\fR). In the POSIX locale, or in a locale where the radix
200 197 character is not defined, the radix character defaults to a period ('.').
201 198 .sp
202 199 .LP
203 200 If the subject sequence is empty or does not have the expected form, no
204 201 conversion is performed; the value of \fInptr\fR is stored in the object
205 202 pointed to by \fIendptr\fR, provided that \fIendptr\fR is not a null pointer.
206 203 .sp
207 204 .LP
↓ open down ↓ |
35 lines elided |
↑ open up ↑ |
208 205 The \fBwcstod()\fR function does not change the setting of \fBerrno\fR if
209 206 successful.
210 207 .sp
211 208 .LP
212 209 The \fBwstod()\fR function is identical to \fBwcstod()\fR.
213 210 .sp
214 211 .LP
215 212 The \fBwatof\fR(\fIstr\fR) function is equivalent to \fBwstod(\fR\fInptr\fR\fB,
216 213 (wchar_t **)NULL)\fR.
217 214 .SH RETURN VALUES
218 -.sp
219 -.LP
220 215 Upon successful completion, these functions return the converted value. If no
221 216 conversion could be performed, \fB0\fR is returned.
222 217 .sp
223 218 .LP
224 219 If the correct value is outside the range of representable values,
225 220 \fB\(+-HUGE_VAL\fR, \fB\(+-HUGE_VALF\fR, or \fB\(+-HUGE_VALL\fR is returned
226 221 (according to the sign of the value), a floating point overflow exception is
227 222 raised, and \fBerrno\fR is set to \fBERANGE\fR.
228 223 .sp
229 224 .LP
230 225 If the correct value would cause an underflow, the correctly rounded result
231 226 (which may be normal, subnormal, or zero) is returned, a floating point
232 227 underflow exception is raised, and \fBerrno\fR is set to \fBERANGE\fR.
233 228 .SH ERRORS
234 -.sp
235 -.LP
236 229 The \fBwcstod()\fR and \fBwstod()\fR functions will fail if:
237 230 .sp
238 231 .ne 2
239 232 .na
240 -\fB\fBERANGE\fR\fR
233 +\fBERANGE\fR
241 234 .ad
242 235 .RS 10n
243 236 The value to be returned would cause overflow or underflow.
244 237 .RE
245 238
246 239 .sp
247 240 .LP
248 241 The \fBwcstod()\fR and \fBwcstod()\fR functions may fail if:
249 242 .sp
250 243 .ne 2
251 244 .na
252 -\fB\fBEINVAL\fR\fR
245 +\fBEINVAL\fR
253 246 .ad
254 247 .RS 10n
255 248 No conversion could be performed.
256 249 .RE
257 250
258 251 .SH USAGE
259 -.sp
260 -.LP
261 252 Because 0 is returned on error and is also a valid return on success, an
262 253 application wishing to check for error situations should set \fBerrno\fR to 0
263 254 call \fBwcstod()\fR, \fBwcstof()\fR, \fBwcstold()\fR, or \fBwstod()\fR, then
264 255 check \fBerrno\fR and if it is non-zero, assume an error has occurred.
265 256 .SH ATTRIBUTES
266 -.sp
267 -.LP
268 257 See \fBattributes\fR(5) for descriptions of the following attributes:
269 258 .sp
270 259
271 260 .sp
272 261 .TS
273 262 box;
274 263 l | l
275 264 l | l .
276 265 ATTRIBUTE TYPE ATTRIBUTE VALUE
277 266 _
278 267 Interface Stability T{
279 268 \fBwcstod()\fR, \fBwcstof()\fR, and \fBwcstold()\fR are Standard.
280 269 T}
281 270 _
282 271 MT-Level MT-Safe
283 272 .TE
284 273
285 274 .SH SEE ALSO
286 -.sp
287 -.LP
288 275 \fBiswspace\fR(3C), \fBlocaleconv\fR(3C), \fBscanf\fR(3C), \fBsetlocale\fR(3C),
289 276 \fBwcstol\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX