diff options
Diffstat (limited to 'src/lib/libc/stdlib/ecvt.3')
-rw-r--r-- | src/lib/libc/stdlib/ecvt.3 | 166 |
1 files changed, 0 insertions, 166 deletions
diff --git a/src/lib/libc/stdlib/ecvt.3 b/src/lib/libc/stdlib/ecvt.3 deleted file mode 100644 index f478f8e4b0..0000000000 --- a/src/lib/libc/stdlib/ecvt.3 +++ /dev/null | |||
@@ -1,166 +0,0 @@ | |||
1 | .\" $OpenBSD: ecvt.3,v 1.13 2019/01/25 00:19:25 millert Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2002 Todd C. Miller <millert@openbsd.org> | ||
4 | .\" | ||
5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
7 | .\" copyright notice and this permission notice appear in all copies. | ||
8 | .\" | ||
9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | .\" | ||
17 | .\" Sponsored in part by the Defense Advanced Research Projects | ||
18 | .\" Agency (DARPA) and Air Force Research Laboratory, Air Force | ||
19 | .\" Materiel Command, USAF, under agreement number F39502-99-1-0512. | ||
20 | .\" | ||
21 | .Dd $Mdocdate: January 25 2019 $ | ||
22 | .Dt ECVT 3 | ||
23 | .Os | ||
24 | .Sh NAME | ||
25 | .Nm ecvt , | ||
26 | .Nm fcvt , | ||
27 | .Nm gcvt | ||
28 | .Nd convert double to ASCII string | ||
29 | .Sh SYNOPSIS | ||
30 | .In stdlib.h | ||
31 | .Ft char * | ||
32 | .Fn ecvt "double value" "int ndigit" "int *decpt" "int *sign" | ||
33 | .Ft char * | ||
34 | .Fn fcvt "double value" "int ndigit" "int *decpt" "int *sign" | ||
35 | .Ft char * | ||
36 | .Fn gcvt "double value" "int ndigit" "char *buf" | ||
37 | .Sh DESCRIPTION | ||
38 | .Bf -symbolic | ||
39 | These functions are provided for compatibility with legacy code. | ||
40 | New code should use the | ||
41 | .Xr snprintf 3 | ||
42 | function for improved safety and portability. | ||
43 | .Ef | ||
44 | .Pp | ||
45 | The | ||
46 | .Fn ecvt , | ||
47 | .Fn fcvt | ||
48 | and | ||
49 | .Fn gcvt | ||
50 | functions convert the double precision floating-point number | ||
51 | .Fa value | ||
52 | to a NUL-terminated | ||
53 | .Tn ASCII | ||
54 | string. | ||
55 | .Pp | ||
56 | The | ||
57 | .Fn ecvt | ||
58 | function converts | ||
59 | .Fa value | ||
60 | to a NUL-terminated string of exactly | ||
61 | .Fa ndigit | ||
62 | digits and returns a pointer to that string. | ||
63 | The result is padded with zeroes from left to right as needed. | ||
64 | There are no leading zeroes unless | ||
65 | .Fa value | ||
66 | itself is 0. | ||
67 | The least significant digit is rounded in an implementation-dependent manner. | ||
68 | The position of the decimal point relative to the beginning of the string | ||
69 | is stored in | ||
70 | .Fa decpt . | ||
71 | A negative value indicates that the decimal point is located | ||
72 | to the left of the returned digits (this occurs when there is no | ||
73 | whole number component to | ||
74 | .Fa value ) . | ||
75 | If | ||
76 | .Fa value | ||
77 | is zero, it is unspecified whether the integer pointed to by | ||
78 | .Fa decpt | ||
79 | will be 0 or 1. | ||
80 | The decimal point itself is not included in the returned string. | ||
81 | If the sign of the result is negative, the integer pointed to by | ||
82 | .Fa sign | ||
83 | is non-zero; otherwise, it is 0. | ||
84 | .Pp | ||
85 | If the converted value is out of range or is not representable, | ||
86 | the contents of the returned string are unspecified. | ||
87 | .Pp | ||
88 | The | ||
89 | .Fn fcvt | ||
90 | function is identical to | ||
91 | .Fn ecvt | ||
92 | with the exception that | ||
93 | .Fa ndigit | ||
94 | specifies the number of digits after the decimal point (zero-padded as | ||
95 | needed). | ||
96 | .Pp | ||
97 | The | ||
98 | .Fn gcvt | ||
99 | function converts | ||
100 | .Fa value | ||
101 | to a NUL-terminated string similar to the %g | ||
102 | .Xr printf 3 | ||
103 | format specifier and stores the result in | ||
104 | .Fa buf . | ||
105 | It produces | ||
106 | .Fa ndigit | ||
107 | significant digits similar to the %f | ||
108 | .Xr printf 3 | ||
109 | format specifier where possible. | ||
110 | If | ||
111 | .Fa ndigit | ||
112 | does allow sufficient precision, the result is stored in | ||
113 | exponential notation similar to the %e | ||
114 | .Xr printf 3 | ||
115 | format specifier. | ||
116 | If | ||
117 | .Fa value | ||
118 | is less than zero, | ||
119 | .Fa buf | ||
120 | will be prefixed with a minus sign. | ||
121 | A decimal point is included in the returned string if | ||
122 | .Fa value | ||
123 | is not a whole number. | ||
124 | Unlike the | ||
125 | .Fn ecvt | ||
126 | and | ||
127 | .Fn fcvt | ||
128 | functions, | ||
129 | .Fa buf | ||
130 | is not zero-padded. | ||
131 | .Sh RETURN VALUES | ||
132 | The | ||
133 | .Fn ecvt , | ||
134 | .Fn fcvt | ||
135 | and | ||
136 | .Fn gcvt | ||
137 | functions return a NUL-terminated string representation of | ||
138 | .Fa value . | ||
139 | .Sh SEE ALSO | ||
140 | .Xr printf 3 , | ||
141 | .Xr strtod 3 | ||
142 | .Sh STANDARDS | ||
143 | The | ||
144 | .Fn ecvt , | ||
145 | .Fn fcvt | ||
146 | and | ||
147 | .Fn gcvt | ||
148 | functions conform to | ||
149 | .St -p1003.1-2001 ; | ||
150 | as of | ||
151 | .St -p1003.1-2008 | ||
152 | they are no longer a part of the standard. | ||
153 | .Sh CAVEATS | ||
154 | The | ||
155 | .Fn ecvt | ||
156 | and | ||
157 | .Fn fcvt | ||
158 | functions return a pointer to internal storage space that will be | ||
159 | overwritten by subsequent calls to either function. | ||
160 | .Pp | ||
161 | The maximum possible precision of the return value is limited by the | ||
162 | precision of a double and may not be the same on all architectures. | ||
163 | .Pp | ||
164 | The | ||
165 | .Xr snprintf 3 | ||
166 | function is preferred over these functions for new code. | ||