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