]> sourceware.org Git - glibc.git/blame - math/tgmath.h
[BZ #13852]
[glibc.git] / math / tgmath.h
CommitLineData
1c298d08 1/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007
58d87ee1 2 Free Software Foundation, Inc.
dfd2257a
UD
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
dfd2257a
UD
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 13 Lesser General Public License for more details.
dfd2257a 14
41bdb6e2 15 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
dfd2257a
UD
18
19/*
63ae7b63 20 * ISO C99 Standard: 7.22 Type-generic math <tgmath.h>
dfd2257a
UD
21 */
22
23#ifndef _TGMATH_H
24#define _TGMATH_H 1
25
26/* Include the needed headers. */
27#include <math.h>
28#include <complex.h>
29
30
31/* Since `complex' is currently not really implemented in most C compilers
32 and if it is implemented, the implementations differ. This makes it
33 quite difficult to write a generic implementation of this header. We
34 do not try this for now and instead concentrate only on GNU CC. Once
35 we have more information support for other compilers might follow. */
36
4360eafd 37#if __GNUC_PREREQ (2, 7)
dfd2257a 38
0d3fee40
UD
39# ifdef __NO_LONG_DOUBLE_MATH
40# define __tgml(fct) fct
41# else
42# define __tgml(fct) fct ## l
43# endif
44
925e31d9
UD
45/* This is ugly but unless gcc gets appropriate builtins we have to do
46 something like this. Don't ask how it works. */
47
48/* 1 if 'type' is a floating type, 0 if 'type' is an integer type.
49 Allows for _Bool. Expands to an integer constant expression. */
acd44dbc
UD
50# if __GNUC_PREREQ (3, 1)
51# define __floating_type(type) \
52 (__builtin_classify_type ((type) 0) == 8 \
53 || (__builtin_classify_type ((type) 0) == 9 \
54 && __builtin_classify_type (__real__ ((type) 0)) == 8))
55# else
56# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))
57# endif
925e31d9
UD
58
59/* The tgmath real type for T, where E is 0 if T is an integer type and
60 1 for a floating type. */
deea1b29 61# define __tgmath_real_type_sub(T, E) \
1c298d08
UD
62 __typeof__ (*(0 ? (__typeof__ (0 ? (double *) 0 : (void *) (E))) 0 \
63 : (__typeof__ (0 ? (T *) 0 : (void *) (!(E)))) 0))
925e31d9
UD
64
65/* The tgmath real type of EXPR. */
deea1b29 66# define __tgmath_real_type(expr) \
1c298d08
UD
67 __tgmath_real_type_sub (__typeof__ ((__typeof__ (expr)) 0), \
68 __floating_type (__typeof__ (expr)))
925e31d9
UD
69
70
dfd2257a
UD
71/* We have two kinds of generic macros: to support functions which are
72 only defined on real valued parameters and those which are defined
73 for complex functions as well. */
74# define __TGMATH_UNARY_REAL_ONLY(Val, Fct) \
1c298d08
UD
75 (__extension__ ((sizeof (Val) == sizeof (double) \
76 || __builtin_classify_type (Val) != 8) \
77 ? (__tgmath_real_type (Val)) Fct (Val) \
78 : (sizeof (Val) == sizeof (float)) \
79 ? (__tgmath_real_type (Val)) Fct##f (Val) \
80 : (__tgmath_real_type (Val)) __tgml(Fct) (Val)))
71502ebe
UD
81
82# define __TGMATH_UNARY_REAL_RET_ONLY(Val, RetType, Fct) \
1c298d08
UD
83 (__extension__ ((sizeof (Val) == sizeof (double) \
84 || __builtin_classify_type (Val) != 8) \
85 ? (RetType) Fct (Val) \
86 : (sizeof (Val) == sizeof (float)) \
87 ? (RetType) Fct##f (Val) \
88 : (RetType) __tgml(Fct) (Val)))
dfd2257a
UD
89
90# define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \
1c298d08
UD
91 (__extension__ ((sizeof (Val1) == sizeof (double) \
92 || __builtin_classify_type (Val1) != 8) \
93 ? (__tgmath_real_type (Val1)) Fct (Val1, Val2) \
94 : (sizeof (Val1) == sizeof (float)) \
95 ? (__tgmath_real_type (Val1)) Fct##f (Val1, Val2) \
96 : (__tgmath_real_type (Val1)) __tgml(Fct) (Val1, Val2)))
dfd2257a
UD
97
98# define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \
1c298d08
UD
99 (__extension__ (((sizeof (Val1) > sizeof (double) \
100 || sizeof (Val2) > sizeof (double)) \
101 && __builtin_classify_type ((Val1) + (Val2)) == 8) \
102 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
103 + (__tgmath_real_type (Val2)) 0)) \
104 __tgml(Fct) (Val1, Val2) \
105 : (sizeof (Val1) == sizeof (double) \
106 || sizeof (Val2) == sizeof (double) \
107 || __builtin_classify_type (Val1) != 8 \
108 || __builtin_classify_type (Val2) != 8) \
109 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
110 + (__tgmath_real_type (Val2)) 0)) \
111 Fct (Val1, Val2) \
112 : (__typeof ((__tgmath_real_type (Val1)) 0 \
113 + (__tgmath_real_type (Val2)) 0)) \
114 Fct##f (Val1, Val2)))
dfd2257a
UD
115
116# define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
1c298d08
UD
117 (__extension__ (((sizeof (Val1) > sizeof (double) \
118 || sizeof (Val2) > sizeof (double)) \
119 && __builtin_classify_type ((Val1) + (Val2)) == 8) \
120 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
121 + (__tgmath_real_type (Val2)) 0)) \
122 __tgml(Fct) (Val1, Val2, Val3) \
123 : (sizeof (Val1) == sizeof (double) \
124 || sizeof (Val2) == sizeof (double) \
125 || __builtin_classify_type (Val1) != 8 \
126 || __builtin_classify_type (Val2) != 8) \
127 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
128 + (__tgmath_real_type (Val2)) 0)) \
129 Fct (Val1, Val2, Val3) \
130 : (__typeof ((__tgmath_real_type (Val1)) 0 \
131 + (__tgmath_real_type (Val2)) 0)) \
132 Fct##f (Val1, Val2, Val3)))
bfce746a
UD
133
134# define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct) \
1c298d08
UD
135 (__extension__ (((sizeof (Val1) > sizeof (double) \
136 || sizeof (Val2) > sizeof (double) \
137 || sizeof (Val3) > sizeof (double)) \
138 && __builtin_classify_type ((Val1) + (Val2) + (Val3)) \
139 == 8) \
140 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
141 + (__tgmath_real_type (Val2)) 0 \
142 + (__tgmath_real_type (Val3)) 0)) \
143 __tgml(Fct) (Val1, Val2, Val3) \
144 : (sizeof (Val1) == sizeof (double) \
145 || sizeof (Val2) == sizeof (double) \
146 || sizeof (Val3) == sizeof (double) \
147 || __builtin_classify_type (Val1) != 8 \
148 || __builtin_classify_type (Val2) != 8 \
149 || __builtin_classify_type (Val3) != 8) \
150 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
151 + (__tgmath_real_type (Val2)) 0 \
152 + (__tgmath_real_type (Val3)) 0)) \
153 Fct (Val1, Val2, Val3) \
154 : (__typeof ((__tgmath_real_type (Val1)) 0 \
155 + (__tgmath_real_type (Val2)) 0 \
156 + (__tgmath_real_type (Val3)) 0)) \
157 Fct##f (Val1, Val2, Val3)))
dfd2257a 158
48244d09
UD
159/* XXX This definition has to be changed as soon as the compiler understands
160 the imaginary keyword. */
dfd2257a 161# define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct) \
1c298d08
UD
162 (__extension__ ((sizeof (__real__ (Val)) == sizeof (double) \
163 || __builtin_classify_type (__real__ (Val)) != 8) \
164 ? ((sizeof (__real__ (Val)) == sizeof (Val)) \
165 ? (__tgmath_real_type (Val)) Fct (Val) \
166 : (__tgmath_real_type (Val)) Cfct (Val)) \
167 : (sizeof (__real__ (Val)) == sizeof (float)) \
168 ? ((sizeof (__real__ (Val)) == sizeof (Val)) \
169 ? (__tgmath_real_type (Val)) Fct##f (Val) \
170 : (__tgmath_real_type (Val)) Cfct##f (Val)) \
171 : ((sizeof (__real__ (Val)) == sizeof (Val)) \
172 ? (__tgmath_real_type (Val)) __tgml(Fct) (Val) \
173 : (__tgmath_real_type (Val)) __tgml(Cfct) (Val))))
174
175# define __TGMATH_UNARY_IMAG(Val, Cfct) \
176 (__extension__ ((sizeof (__real__ (Val)) == sizeof (double) \
177 || __builtin_classify_type (__real__ (Val)) != 8) \
178 ? (__typeof__ ((__tgmath_real_type (Val)) 0 \
179 + _Complex_I)) Cfct (Val) \
180 : (sizeof (__real__ (Val)) == sizeof (float)) \
181 ? (__typeof__ ((__tgmath_real_type (Val)) 0 \
182 + _Complex_I)) Cfct##f (Val) \
183 : (__typeof__ ((__tgmath_real_type (Val)) 0 \
184 + _Complex_I)) __tgml(Cfct) (Val)))
dfd2257a 185
58d87ee1
UD
186/* XXX This definition has to be changed as soon as the compiler understands
187 the imaginary keyword. */
188# define __TGMATH_UNARY_REAL_IMAG_RET_REAL(Val, Fct, Cfct) \
1c298d08
UD
189 (__extension__ ((sizeof (__real__ (Val)) == sizeof (double) \
190 || __builtin_classify_type (__real__ (Val)) != 8) \
191 ? ((sizeof (__real__ (Val)) == sizeof (Val)) \
192 ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
193 Fct (Val) \
194 : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
195 Cfct (Val)) \
196 : (sizeof (__real__ (Val)) == sizeof (float)) \
197 ? ((sizeof (__real__ (Val)) == sizeof (Val)) \
198 ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
199 Fct##f (Val) \
200 : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
201 Cfct##f (Val)) \
202 : ((sizeof (__real__ (Val)) == sizeof (Val)) \
203 ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
204 __tgml(Fct) (Val) \
205 : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
206 __tgml(Cfct) (Val))))
58d87ee1 207
48244d09
UD
208/* XXX This definition has to be changed as soon as the compiler understands
209 the imaginary keyword. */
dfd2257a 210# define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \
1c298d08
UD
211 (__extension__ (((sizeof (__real__ (Val1)) > sizeof (double) \
212 || sizeof (__real__ (Val2)) > sizeof (double)) \
213 && __builtin_classify_type (__real__ (Val1) \
214 + __real__ (Val2)) == 8) \
215 ? ((sizeof (__real__ (Val1)) == sizeof (Val1) \
216 && sizeof (__real__ (Val2)) == sizeof (Val2)) \
217 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
218 + (__tgmath_real_type (Val2)) 0)) \
219 __tgml(Fct) (Val1, Val2) \
220 : (__typeof ((__tgmath_real_type (Val1)) 0 \
221 + (__tgmath_real_type (Val2)) 0)) \
222 __tgml(Cfct) (Val1, Val2)) \
223 : (sizeof (__real__ (Val1)) == sizeof (double) \
224 || sizeof (__real__ (Val2)) == sizeof (double) \
225 || __builtin_classify_type (__real__ (Val1)) != 8 \
226 || __builtin_classify_type (__real__ (Val2)) != 8) \
227 ? ((sizeof (__real__ (Val1)) == sizeof (Val1) \
228 && sizeof (__real__ (Val2)) == sizeof (Val2)) \
229 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
230 + (__tgmath_real_type (Val2)) 0)) \
231 Fct (Val1, Val2) \
232 : (__typeof ((__tgmath_real_type (Val1)) 0 \
233 + (__tgmath_real_type (Val2)) 0)) \
234 Cfct (Val1, Val2)) \
235 : ((sizeof (__real__ (Val1)) == sizeof (Val1) \
236 && sizeof (__real__ (Val2)) == sizeof (Val2)) \
237 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
238 + (__tgmath_real_type (Val2)) 0)) \
239 Fct##f (Val1, Val2) \
240 : (__typeof ((__tgmath_real_type (Val1)) 0 \
241 + (__tgmath_real_type (Val2)) 0)) \
242 Cfct##f (Val1, Val2))))
dfd2257a
UD
243#else
244# error "Unsupported compiler; you cannot use <tgmath.h>"
245#endif
246
247
248/* Unary functions defined for real and complex values. */
249
250
251/* Trigonometric functions. */
252
253/* Arc cosine of X. */
254#define acos(Val) __TGMATH_UNARY_REAL_IMAG (Val, acos, cacos)
255/* Arc sine of X. */
256#define asin(Val) __TGMATH_UNARY_REAL_IMAG (Val, asin, casin)
257/* Arc tangent of X. */
258#define atan(Val) __TGMATH_UNARY_REAL_IMAG (Val, atan, catan)
259/* Arc tangent of Y/X. */
cfb32a6c 260#define atan2(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, atan2)
dfd2257a
UD
261
262/* Cosine of X. */
263#define cos(Val) __TGMATH_UNARY_REAL_IMAG (Val, cos, ccos)
264/* Sine of X. */
265#define sin(Val) __TGMATH_UNARY_REAL_IMAG (Val, sin, csin)
266/* Tangent of X. */
267#define tan(Val) __TGMATH_UNARY_REAL_IMAG (Val, tan, ctan)
268
269
270/* Hyperbolic functions. */
271
272/* Hyperbolic arc cosine of X. */
273#define acosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, acosh, cacosh)
274/* Hyperbolic arc sine of X. */
275#define asinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, asinh, casinh)
276/* Hyperbolic arc tangent of X. */
277#define atanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, atanh, catanh)
278
279/* Hyperbolic cosine of X. */
280#define cosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, cosh, ccosh)
281/* Hyperbolic sine of X. */
282#define sinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, sinh, csinh)
283/* Hyperbolic tangent of X. */
284#define tanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, tanh, ctanh)
285
286
287/* Exponential and logarithmic functions. */
288
289/* Exponential function of X. */
290#define exp(Val) __TGMATH_UNARY_REAL_IMAG (Val, exp, cexp)
291
292/* Break VALUE into a normalized fraction and an integral power of 2. */
293#define frexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, frexp)
294
295/* X times (two to the EXP power). */
296#define ldexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, ldexp)
297
298/* Natural logarithm of X. */
299#define log(Val) __TGMATH_UNARY_REAL_IMAG (Val, log, clog)
300
301/* Base-ten logarithm of X. */
cc3fa755
UD
302#ifdef __USE_GNU
303# define log10(Val) __TGMATH_UNARY_REAL_IMAG (Val, log10, __clog10)
304#else
305# define log10(Val) __TGMATH_UNARY_REAL_ONLY (Val, log10)
306#endif
dfd2257a
UD
307
308/* Return exp(X) - 1. */
309#define expm1(Val) __TGMATH_UNARY_REAL_ONLY (Val, expm1)
310
311/* Return log(1 + X). */
312#define log1p(Val) __TGMATH_UNARY_REAL_ONLY (Val, log1p)
313
314/* Return the base 2 signed integral exponent of X. */
315#define logb(Val) __TGMATH_UNARY_REAL_ONLY (Val, logb)
316
317/* Compute base-2 exponential of X. */
318#define exp2(Val) __TGMATH_UNARY_REAL_ONLY (Val, exp2)
319
320/* Compute base-2 logarithm of X. */
321#define log2(Val) __TGMATH_UNARY_REAL_ONLY (Val, log2)
322
323
324/* Power functions. */
325
326/* Return X to the Y power. */
327#define pow(Val1, Val2) __TGMATH_BINARY_REAL_IMAG (Val1, Val2, pow, cpow)
328
329/* Return the square root of X. */
330#define sqrt(Val) __TGMATH_UNARY_REAL_IMAG (Val, sqrt, csqrt)
331
332/* Return `sqrt(X*X + Y*Y)'. */
333#define hypot(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, hypot)
334
335/* Return the cube root of X. */
336#define cbrt(Val) __TGMATH_UNARY_REAL_ONLY (Val, cbrt)
337
338
339/* Nearest integer, absolute value, and remainder functions. */
340
341/* Smallest integral value not less than X. */
342#define ceil(Val) __TGMATH_UNARY_REAL_ONLY (Val, ceil)
343
344/* Absolute value of X. */
f1debaf6 345#define fabs(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, fabs, cabs)
dfd2257a
UD
346
347/* Largest integer not greater than X. */
348#define floor(Val) __TGMATH_UNARY_REAL_ONLY (Val, floor)
349
350/* Floating-point modulo remainder of X/Y. */
351#define fmod(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmod)
352
353/* Round X to integral valuein floating-point format using current
354 rounding direction, but do not raise inexact exception. */
355#define nearbyint(Val) __TGMATH_UNARY_REAL_ONLY (Val, nearbyint)
356
357/* Round X to nearest integral value, rounding halfway cases away from
358 zero. */
359#define round(Val) __TGMATH_UNARY_REAL_ONLY (Val, round)
360
361/* Round X to the integral value in floating-point format nearest but
362 not larger in magnitude. */
363#define trunc(Val) __TGMATH_UNARY_REAL_ONLY (Val, trunc)
364
365/* Compute remainder of X and Y and put in *QUO a value with sign of x/y
366 and magnitude congruent `mod 2^n' to the magnitude of the integral
367 quotient x/y, with n >= 3. */
368#define remquo(Val1, Val2, Val3) \
369 __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY (Val1, Val2, Val3, remquo)
370
371/* Round X to nearest integral value according to current rounding
372 direction. */
71502ebe
UD
373#define lrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, lrint)
374#define llrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long long int, llrint)
dfd2257a
UD
375
376/* Round X to nearest integral value, rounding halfway cases away from
377 zero. */
71502ebe
UD
378#define lround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, lround)
379#define llround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long long int, llround)
dfd2257a
UD
380
381
382/* Return X with its signed changed to Y's. */
383#define copysign(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, copysign)
384
385/* Error and gamma functions. */
386#define erf(Val) __TGMATH_UNARY_REAL_ONLY (Val, erf)
387#define erfc(Val) __TGMATH_UNARY_REAL_ONLY (Val, erfc)
00d8bc81 388#define tgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, tgamma)
dfd2257a
UD
389#define lgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, lgamma)
390
391
392/* Return the integer nearest X in the direction of the
393 prevailing rounding mode. */
394#define rint(Val) __TGMATH_UNARY_REAL_ONLY (Val, rint)
395
396/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
397#define nextafter(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, nextafter)
42bd0a85
UD
398#define nexttoward(Val1, Val2) \
399 __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, nexttoward)
dfd2257a
UD
400
401/* Return the remainder of integer divison X / Y with infinite precision. */
402#define remainder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, remainder)
403
404/* Return X times (2 to the Nth power). */
26644e87 405#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
204e299e 406# define scalb(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, scalb)
26644e87 407#endif
dfd2257a
UD
408
409/* Return X times (2 to the Nth power). */
410#define scalbn(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbn)
411
412/* Return X times (2 to the Nth power). */
413#define scalbln(Val1, Val2) \
414 __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbln)
415
416/* Return the binary exponent of X, which must be nonzero. */
301a6724 417#define ilogb(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, int, ilogb)
dfd2257a
UD
418
419
420/* Return positive difference between X and Y. */
421#define fdim(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fdim)
422
423/* Return maximum numeric value from X and Y. */
424#define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax)
425
426/* Return minimum numeric value from X and Y. */
427#define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin)
428
429
bfce746a 430/* Multiply-add function computed as a ternary operation. */
e7c3d12b 431#define fma(Val1, Val2, Val3) \
bfce746a
UD
432 __TGMATH_TERNARY_REAL_ONLY (Val1, Val2, Val3, fma)
433
434
dfd2257a
UD
435/* Absolute value, conjugates, and projection. */
436
437/* Argument value of Z. */
f1debaf6 438#define carg(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, carg, carg)
dfd2257a
UD
439
440/* Complex conjugate of Z. */
1c298d08 441#define conj(Val) __TGMATH_UNARY_IMAG (Val, conj)
dfd2257a
UD
442
443/* Projection of Z onto the Riemann sphere. */
1c298d08 444#define cproj(Val) __TGMATH_UNARY_IMAG (Val, cproj)
dfd2257a
UD
445
446
447/* Decomposing complex values. */
448
449/* Imaginary part of Z. */
58d87ee1 450#define cimag(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, cimag, cimag)
dfd2257a
UD
451
452/* Real part of Z. */
58d87ee1 453#define creal(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, creal, creal)
dfd2257a
UD
454
455#endif /* tgmath.h */
This page took 0.389084 seconds and 5 git commands to generate.