Unleashed v1.4
[unleashed.git] / share / man / man3head / tgmath.h.3head
blobee980dd869787efb9fc2723af6e322b175bf5014
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright (c) 2001, The IEEE and The Open Group.  All Rights Reserved.
44 .\" Portions Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved.
45 .\"
46 .TH TGMATH.H 3HEAD "Dec 17, 2003"
47 .SH NAME
48 tgmath.h, tgmath \- type-generic macros
49 .SH SYNOPSIS
50 .LP
51 .nf
52 #include <\fBtgmath.h\fR>
53 .fi
55 .SH DESCRIPTION
56 .sp
57 .LP
58 The <\fBtgmath.h\fR> header includes the headers <\fBmath.h\fR> and
59 <\fBcomplex.h\fR> and defines several type-generic macros.
60 .sp
61 .LP
62 Of the functions contained within the <\fBmath.h\fR> and <\fBcomplex.h\fR>
63 headers without an \fBf\fR (float) or \fBl\fR (\fBlong double\fR) suffix,
64 several have one or more parameters whose corresponding real type is
65 \fBdouble\fR. For each such function except \fBmodf\fR(3M), there is  a
66 corresponding type-generic macro. The parameters whose corresponding real type
67 is \fBdouble\fR in the function synopsis are generic parameters. Use of the
68 macro invokes a function whose corresponding real type and type domain are
69 determined by the arguments for the generic parameters.
70 .sp
71 .LP
72 Use of the macro invokes a function whose generic parameters have the
73 corresponding real type determined as follows:
74 .RS +4
75 .TP
76 .ie t \(bu
77 .el o
78 First, if any argument for generic parameters has type \fBlong double\fR, the
79 type determined is \fBlong double\fR.
80 .RE
81 .RS +4
82 .TP
83 .ie t \(bu
84 .el o
85 Otherwise, if any argument for generic parameters has type \fBdouble\fR or is
86 of integer type, the type determined is \fBdouble\fR.
87 .RE
88 .RS +4
89 .TP
90 .ie t \(bu
91 .el o
92 Otherwise, the type determined is \fBfloat\fR.
93 .RE
94 .sp
95 .LP
96 For each unsuffixed function in the <\fBmath.h\fR> header for which there is a
97 function in the <\fBcomplex.h\fR> header with the same name except for a
98 \fBc\fR prefix, the corresponding type-generic macro (for both functions) has
99 the same name as the function in the <\fBmath.h\fR> header. The corresponding
100 type-generic macro for \fBfabs()\fR and \fBcabs()\fR is \fBfabs()\fR.
105 c c c
106 l l l .
107 <\fBmath.h\fR> Function <\fBcomplex.h\fR> Function      Type-Generic Macro
109 \fBacos()\fR    \fBcacos()\fR   \fBacos()\fR
110 \fBasin()\fR    \fBcasin()\fR   \fBasin()\fR
111 \fBatan()\fR    \fBcatan()\fR   \fBatan()\fR
112 \fBacosh()\fR   \fBcacosh()\fR  \fBacosh()\fR
113 \fBasinh()\fR   \fBcasinh()\fR  \fBasinh()\fR
114 \fBatanh()\fR   \fBcatanh()\fR  \fBatanh()\fR
115 \fBcos()\fR     \fBccos()\fR    \fBcos()\fR
116 \fBsin()\fR     \fBcsin()\fR    \fBsin()\fR
117 \fBtan()\fR     \fBctan()\fR    \fBtan()\fR
118 \fBcosh()\fR    \fBccosh()\fR   \fBcosh()\fR
119 \fBsinh()\fR    \fBcsinh()\fR   \fBsinh()\fR
120 \fBtanh()\fR    \fBctanh()\fR   \fBtanh()\fR
121 \fBexp()\fR     \fBcexp()\fR    \fBexp()\fR
122 \fBlog()\fR     \fBclog()\fR    \fBlog()\fR
123 \fBpow()\fR     \fBcpow()\fR    \fBpow()\fR
124 \fBsqrt()\fR    \fBcsqrt()\fR   \fBsqrt()\fR
125 \fBfabs()\fR    \fBcfabs()\fR   \fBfabs()\fR
130 If at least one argument for a generic parameter is complex, then use of the
131 macro invokes a complex function; otherwise, use of the macro invokes a real
132 function.
135 For each unsuffixed function in the <\fBmath.h\fR> header without a
136 \fBc\fR-prefixed counterpart in the <\fBcomplex.h\fR> header, the corresponding
137 type-generic macro has the same name as the function. These type-generic macros
138 are:
140 .in +2
142 atan2()       fma()     llround()       remainder()
143 cbrt()        fmax()    log10()         remquo()
144 ceil()        fmin()    log1p()         rint()
145 copysign()    fmod()    log2()          round()
146 erf()         frexp()   logb()          scalbn()
147 erfc()        hypot()   lrint()         scalbln()
148 exp2()        ilogb()   lround()        tgamma()
149 expm1()       ldexp()   nearbyint()     trunc()
150 fdim()        lgamma()  nextafter()
151 floor()       llrint()  nexttoward()
153 .in -2
157 If all arguments for generic parameters are real, then use of the macro invokes
158 a real function; otherwise, use of the macro results in undefined behavior.
161 For each unsuffixed function in the <\fBcomplex.h\fR> header that is not a
162 \fBc\fR-prefixed counterpart to a function in the <\fBmath.h\fR> header, the
163 corresponding type-generic macro has the same name as the function. These
164 type-generic macros are:
166 .in +2
168 carg()
169 cimag()
170 conj()
171 cproj()
172 creal()
174 .in -2
178 Use of the macro with any real or complex argument invokes a complex function.
179 .SH USAGE
182 Functions invoked by use of type-generic macros are invoked with the
183 declarations listed below.
185 .in +2
187 #include <tgmath.h>
188 int n;
189 float f;
190 double d;
191 long double ld;
192 float complex fc;
193 double complex dc;
194 long double complex ldc;
196 .in -2
200 The following are the type-generic macros that invoke the functions that are
201 invoked with the preceding declarations.
206 c c
207 l l .
208 Macro   Use Invokes
210 exp(n)  exp(n), the function
211 acosh(f)        acoshf(f)
212 sin(d)  sin(d), the function
213 atan(ld)        atanl(ld)
214 log(fc) clogf(fc)
215 sqrt(dc)        csqrt(dc)
216 pow(ldc,f)      cpowl(ldc, f)
217 remainder(n,n)  remainder(n, n), the function
218 nextafter(d,f)  nextafter(d, f), the function
219 nexttoward(f,ld)        nexttowardf(f, ld)
220 copysign(n,ld)  copysignl(n, ld)
221 ceil(fc)        undefined behavior
222 rint(dc)        undefined behavior
223 fmax(ldc,ld)    undefined behavior
224 carg(n) carg(n), the function
225 cproj(f)        cprojf(f)
226 creal(d)        creal(d), the function
227 cimag(ld)       cimagl(ld)
228 cabs(fc)        cabsf(fc)
229 carg(dc)        carg(dc), the function
230 cproj(ldc)      cprojl(ldc)
233 .SH ATTRIBUTES
236 See \fBattributes\fR(5) for descriptions of the following attributes:
241 box;
242 c | c
243 l | l .
244 ATTRIBUTE TYPE  ATTRIBUTE VALUE
246 Interface Stability     Standard
249 .SH SEE ALSO
252 \fBmodf\fR(3M), \fBcomplex.h\fR(3HEAD), \fBmath.h\fR(3HEAD), \fBcabs\fR(3M),
253 \fBfabs\fR(3M), \fBattributes\fR(5), \fBstandards\fR(5)