OSDN Git Service

(split) LDP_man-pages: release ioctl.2 [JM:00378]
[linuxjm/LDP_man-pages.git] / draft / man3 / ecvt.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified Sat Jul 24 19:40:39 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified Fri Jun 25 12:10:47 1999 by Andries Brouwer (aeb@cwi.nl)
29 .\"
30 .\" Japanese Version Copyright (c) 1997 Hiroaki Nagoya
31 .\"         all rights reserved.
32 .\" Translated Mon Feb 10 1997 by Hiroaki Nagoya <nagoya@is.titech.ac.jp>
33 .\" Updated 2000-01-08 by Kentaro Shirakata <argrath@ub32.org>
34 .\" Updated 2009-04-22 by Kentaro Shirakata <argrath@ub32.org>
35 .\"
36 .TH ECVT 3 2010-09-20 "" "Linux Programmer's Manual"
37 .\"O .SH NAME
38 .SH Ì¾Á°
39 .\"O ecvt, fcvt \- convert a floating-point number to a string
40 ecvt, fcvt \- ÉâÆ°¾®¿ôÅÀ¿ô¤Îʸ»úÎó¤Ø¤ÎÊÑ´¹
41 .\"O .SH SYNOPSIS
42 .SH ½ñ¼°
43 .B #include <stdlib.h>
44 .sp
45 .BI "char *ecvt(double " number ", int " ndigits ", int *" decpt ,
46 .BI "int *" sign );
47 .sp
48 .BI "char *fcvt(double " number ", int " ndigits ", int *" decpt ,
49 .BI "int *" sign );
50 .sp
51 .in -4n
52 .\"O Feature Test Macro Requirements for glibc (see
53 .\"O .BR feature_test_macros (7)):
54 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
55 .RB ( feature_test_macros (7)
56 »²¾È):
57 .in
58 .sp
59 .BR ecvt (),
60 .BR fcvt ():
61 .ad l
62 .RS 4
63 .PD 0
64 .TP 4
65 .\"O Since glibc 2.12:
66 glibc 2.12 °Ê¹ß:
67 .nf
68 _SVID_SOURCE ||
69     (_XOPEN_SOURCE\ >=\ 500 ||
70         _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) &&
71     !(_POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600)
72 .fi
73 .TP 4
74 .\"O Before glibc 2.12:
75 glibc 2.12 ¤è¤êÁ°:
76 _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
77 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
78 .PD
79 .RE
80 .ad b
81 .\"O .SH DESCRIPTION
82 .SH ÀâÌÀ
83 .\"O The
84 .\"O .BR ecvt ()
85 .\"O function converts \fInumber\fP to a null-terminated
86 .\"O string of \fIndigits\fP digits (where \fIndigits\fP is reduced to a
87 .\"O system-specific limit determined by the precision of a
88 .\"O .IR double ),
89 .\"O and returns a pointer to the string.
90 .\"O The high-order digit is nonzero, unless
91 .\"O .I number
92 .\"O is zero.
93 .\"O The low order digit is rounded.
94 ´Ø¿ô
95 .BR ecvt ()
96 ¤Ï \fInumber\fP ¤ò NUL Ê¸»ú¤Ç½ªÃ¼¤µ¤ì¤¿
97 \fIndigits\fP Ê¸»ú¤Îʸ»úÎó¤ØÊÑ´¹¤·¡¢¤½¤Îʸ»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹
98 (\fIndigits\fP ¤¬
99 .I double
100 ¤ÎÀºÅ٤ˤè¤Ã¤Æ·èÄꤵ¤ì¤ë¥·¥¹¥Æ¥à°Í¸¤Î¾å¸ÂÃͤè¤êÂ礭¤¤¾ì¹ç¤Ï¡¢
101 ¤½¤Î¾ò·ïÃͤ¬ \fIndigits\fP ¤ÎÃͤȤʤë)¡£
102 .I number
103 ¤¬ 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢ºÇ¾å°Ì¤Î·å¤Ï 0 °Ê³°¤Ç¤¢¤ë¡£
104 ºÇ²¼°Ì¤Î·å¤Ï´Ý¤á¤é¤ì¤ë¡£
105 .\"O The string itself does not contain a decimal point; however,
106 .\"O the position of the decimal point relative to the start of the string
107 .\"O is stored in \fI*decpt\fP.
108 .\"O A negative value for \fI*decpt\fP means that
109 .\"O the decimal point is to the left of the start of the string.
110 .\"O If the sign of
111 .\"O \fInumber\fP is negative, \fI*sign\fP is set to a nonzero value,
112 .\"O otherwise it's set to 0.
113 .\"O If
114 .\"O .I number
115 .\"O is zero, it is unspecified whether \fI*decpt\fP is 0 or 1.
116 ʸ»úÎó¤Ë¤Ï¾®¿ôÅÀ¤Ï´Þ¤Þ¤ì¤Ê¤¤¡£¤½¤Î¤«¤ï¤ê¤Ë¡¢Ê¸»úÎó¤ÎÀèƬ¤«¤é¤Î¾®¿ôÅÀ¤Î
117 °ÌÃÖ¤¬ \fI*decpt\fP ¤ËÊÝ»ý¤µ¤ì¤ë¡£
118 \fI*decpt\fP ¤¬Éé¤ÎÃͤξì¹ç¡¢¾®¿ôÅÀ¤¬Ê¸»úÎó¤ÎÀèƬ¤Îº¸Â¦¤Ë¤¢¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
119 ¤â¤·(\fInumber\fP¤Î)Éä¹æ¤¬Éé¤Ê¤é¤Ð \fI*sign\fP ¤Ï 0 °Ê³°¤ÎÃͤˡ¢
120 ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð 0 ¤ËÀßÄꤵ¤ì¤ë¡£
121 .I number
122 ¤¬ 0 ¤Ê¤é¡¢\fI*decpt\fP ¤¬ 0 ¤« 1 ¤«¤Ï̤µ¬Äê¤Ç¤¢¤ë¡£
123 .PP
124 .\"O The
125 .\"O .BR fcvt ()
126 .\"O function is identical to
127 .\"O .BR ecvt (),
128 .\"O except that
129 .\"O \fIndigits\fP specifies the number of digits after the decimal point.
130 ´Ø¿ô
131 .BR fcvt ()
132 ¤Ï
133 .BR ecvt ()
134 ¤ÈƱ¤¸µ¡Ç½¤ò»ý¤Ä¤¬¡¢\fIndigits\fP ¤Ï¾®¿ôÅÀ°Ê²¼¤Îʸ»ú¿ô¤ò»ØÄꤹ¤ë¡£
135 .\"O .SH "RETURN VALUE"
136 .SH ÊÖ¤êÃÍ
137 .\"O Both the
138 .\"O .BR ecvt ()
139 .\"O and
140 .\"O .BR fcvt ()
141 .\"O functions return a pointer to a
142 .\"O static string containing the ASCII representation of \fInumber\fP.
143 ´Ø¿ô
144 .BR ecvt ()
145 ¤È
146 .BR fcvt ()
147 ¤Ï \fInumber\fP ¤Î ASCII É½¸½¤ò´Þ¤à
148 ÀÅŪ¤ÊÎΰèÆâ¤Îʸ»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
149 .\"O The static string is overwritten by each call to
150 .\"O .BR ecvt ()
151 .\"O or
152 .\"O .BR fcvt ().
153 ¤³¤Îʸ»úÎó¤Ï
154 .BR ecvt ()
155 ¤ä
156 .BR fcvt ()
157 ¤Î¸Æ¤Ó½Ð¤·¤Î¤¿¤Ó¤Ë¾å½ñ¤­¤µ¤ì¤ë¡£
158 .\"O .SH "CONFORMING TO"
159 .SH ½àµò
160 .\"O SVr2;
161 .\"O marked as LEGACY in POSIX.1-2001.
162 SVr2¡£
163 POSIX.1-2001 ¤Ç¤Ï¡Ö²áµî¤Î̾»Ä (LEGACY)¡×¤È°ÌÃÖÉÕ¤±¤é¤ì¤Æ¤¤¤ë¡£
164 .\"O POSIX.1-2008 removes the specifications of
165 .\"O .BR ecvt ()
166 .\"O and
167 .\"O .BR fcvt (),
168 .\"O recommending the use of
169 .\"O .BR sprintf (3)
170 .\"O instead (though
171 .\"O .BR snprintf (3)
172 .\"O may be preferable).
173 POSIX.1-2008 ¤Ç¤Ï
174 .BR ecvt ()
175 ¤È
176 .BR fcvt ()
177 ¤Î»ÅÍͤ¬ºï½ü¤µ¤ì¡¢Âå¤ï¤ê¤Ë
178 .BR sprintf (3)
179 ¤Î»ÈÍѤ¬¿ä¾©¤µ¤ì¤Æ¤¤¤ë(¤·¤«¤·
180 .BR snprintf (3)
181 ¤¬¤è¤êŬÀÚ¤«¤â¤·¤ì¤Ê¤¤)¡£
182 .\"O .SH NOTES
183 .SH Ãí°Õ
184 .\"O Linux libc4 and libc5 specified the type of
185 .\"O .I ndigits
186 .\"O as
187 .\"O .IR size_t .
188 Linux libc4 ¤È libc5 ¤Ç¤Ï
189 .I ndigits
190 ¤Î·¿¤Ï
191 .I size_t
192 ¤È¤Ê¤Ã¤Æ¤¤¤¿¡£
193 .\"O Not all locales use a point as the radix character ("decimal point").
194 ¾®¿ôÅÀ¤Ë¥Ô¥ê¥ª¥É¤ò»È¤ï¤Ê¤¤¥í¥±¡¼¥ë¤â¤¢¤ë¡£
195 .\"O .SH "SEE ALSO"
196 .SH ´ØÏ¢¹àÌÜ
197 .BR ecvt_r (3),
198 .BR gcvt (3),
199 .BR qecvt (3),
200 .BR setlocale (3),
201 .BR sprintf (3)