diff options
Diffstat (limited to 'src/lib/libc/stdlib/strtod.3')
-rw-r--r-- | src/lib/libc/stdlib/strtod.3 | 176 |
1 files changed, 0 insertions, 176 deletions
diff --git a/src/lib/libc/stdlib/strtod.3 b/src/lib/libc/stdlib/strtod.3 deleted file mode 100644 index ad8f28a02f..0000000000 --- a/src/lib/libc/stdlib/strtod.3 +++ /dev/null | |||
@@ -1,176 +0,0 @@ | |||
1 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. | ||
2 | .\" All rights reserved. | ||
3 | .\" | ||
4 | .\" This code is derived from software contributed to Berkeley by | ||
5 | .\" the American National Standards Committee X3, on Information | ||
6 | .\" Processing Systems. | ||
7 | .\" | ||
8 | .\" Redistribution and use in source and binary forms, with or without | ||
9 | .\" modification, are permitted provided that the following conditions | ||
10 | .\" are met: | ||
11 | .\" 1. Redistributions of source code must retain the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer. | ||
13 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
14 | .\" notice, this list of conditions and the following disclaimer in the | ||
15 | .\" documentation and/or other materials provided with the distribution. | ||
16 | .\" 3. Neither the name of the University nor the names of its contributors | ||
17 | .\" may be used to endorse or promote products derived from this software | ||
18 | .\" without specific prior written permission. | ||
19 | .\" | ||
20 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
21 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
22 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
24 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
26 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
27 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
28 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
30 | .\" SUCH DAMAGE. | ||
31 | .\" | ||
32 | .\" $OpenBSD: strtod.3,v 1.23 2022/09/11 06:38:11 jmc Exp $ | ||
33 | .\" | ||
34 | .Dd $Mdocdate: September 11 2022 $ | ||
35 | .Dt STRTOD 3 | ||
36 | .Os | ||
37 | .Sh NAME | ||
38 | .Nm strtod , | ||
39 | .Nm strtof , | ||
40 | .Nm strtold | ||
41 | .Nd convert ASCII string to double, float or long double | ||
42 | .Sh SYNOPSIS | ||
43 | .In stdlib.h | ||
44 | .Ft double | ||
45 | .Fn strtod "const char *nptr" "char **endptr" | ||
46 | .Pp | ||
47 | .Ft float | ||
48 | .Fn strtof "const char *nptr" "char **endptr" | ||
49 | .Pp | ||
50 | .Ft long double | ||
51 | .Fn strtold "const char *nptr" "char **endptr" | ||
52 | .Sh DESCRIPTION | ||
53 | The | ||
54 | .Fn strtod | ||
55 | function converts the initial portion of the string pointed to by | ||
56 | .Fa nptr | ||
57 | to | ||
58 | .Vt double | ||
59 | representation. | ||
60 | The | ||
61 | .Fn strtof | ||
62 | function converts the initial portion of the string pointed to by | ||
63 | .Fa nptr | ||
64 | to | ||
65 | .Vt float | ||
66 | representation. | ||
67 | The | ||
68 | .Fn strtold | ||
69 | function converts the initial portion of the string pointed to by | ||
70 | .Fa nptr | ||
71 | to | ||
72 | .Vt long double | ||
73 | representation. | ||
74 | .Pp | ||
75 | The expected form of the string is an optional plus | ||
76 | .Pq Ql + | ||
77 | or minus sign | ||
78 | .Pq Ql - | ||
79 | followed by a sequence of digits optionally containing | ||
80 | a decimal-point character, optionally followed by an exponent. | ||
81 | An exponent consists of an | ||
82 | .Sq E | ||
83 | or | ||
84 | .Sq e , | ||
85 | followed by an optional plus or minus sign, followed by a sequence of digits. | ||
86 | .Pp | ||
87 | Alternatively, if the portion of the string following the optional | ||
88 | plus or minus sign begins with | ||
89 | .Dq INF | ||
90 | or | ||
91 | .Dq NAN , | ||
92 | ignoring case, it is interpreted as an infinity or a quiet \*(Na, | ||
93 | respectively. | ||
94 | The syntax | ||
95 | .Dq NAN Ns Pq Ar s , | ||
96 | where | ||
97 | .Ar s | ||
98 | is an alphanumeric string, produces the same value as the call | ||
99 | .Fo nan | ||
100 | .Qq Ar s Ns | ||
101 | .Fc | ||
102 | (respectively, | ||
103 | .Fo nanf | ||
104 | .Qq Ar s Ns | ||
105 | .Fc | ||
106 | and | ||
107 | .Fo nanl | ||
108 | .Qq Ar s Ns | ||
109 | .Fc ) . | ||
110 | .Pp | ||
111 | In any of the above cases, leading whitespace characters in the | ||
112 | string (as defined by the | ||
113 | .Xr isspace 3 | ||
114 | function) are skipped. | ||
115 | .Sh RETURN VALUES | ||
116 | The | ||
117 | .Fn strtod , | ||
118 | .Fn strtof | ||
119 | and | ||
120 | .Fn strtold | ||
121 | functions return the converted value, if any. | ||
122 | .Pp | ||
123 | If | ||
124 | .Fa endptr | ||
125 | is not | ||
126 | .Dv NULL , | ||
127 | a pointer to the character after the last character used | ||
128 | in the conversion is stored in the location referenced by | ||
129 | .Fa endptr . | ||
130 | .Pp | ||
131 | If no conversion is performed, zero is returned and the value of | ||
132 | .Fa nptr | ||
133 | is stored in the location referenced by | ||
134 | .Fa endptr . | ||
135 | .Pp | ||
136 | If the correct value would cause overflow, plus or minus | ||
137 | .Dv HUGE_VAL | ||
138 | is returned (according to the sign of the value), and | ||
139 | .Er ERANGE | ||
140 | is stored in | ||
141 | .Va errno . | ||
142 | If the correct value would cause underflow, zero is returned and | ||
143 | .Er ERANGE | ||
144 | is stored in | ||
145 | .Va errno . | ||
146 | .Sh ERRORS | ||
147 | .Bl -tag -width Er | ||
148 | .It Bq Er ERANGE | ||
149 | Overflow or underflow occurred. | ||
150 | .El | ||
151 | .Sh SEE ALSO | ||
152 | .Xr atof 3 , | ||
153 | .Xr atoi 3 , | ||
154 | .Xr atol 3 , | ||
155 | .Xr strtol 3 , | ||
156 | .Xr strtoul 3 | ||
157 | .Sh STANDARDS | ||
158 | The | ||
159 | .Fn strtod | ||
160 | function conforms to | ||
161 | .St -ansiC-89 . | ||
162 | The | ||
163 | .Fn strtof | ||
164 | and | ||
165 | .Fn strtold | ||
166 | functions conform to | ||
167 | .St -isoC-99 . | ||
168 | .Sh CAVEATS | ||
169 | On systems other than | ||
170 | .Ox , | ||
171 | the | ||
172 | .Dv LC_NUMERIC | ||
173 | .Xr locale 1 | ||
174 | category can cause parsing failures; see CAVEATS in | ||
175 | .Xr setlocale 3 | ||
176 | for details. | ||