Dr Andrew Scott G7VAV

My photo
 
April 2024
Mo Tu We Th Fr Sa Su
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 1 2 3 4 5
6 7 8 9 10 11 12


tgmath.h
001: /* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007
002:    Free Software Foundation, Inc.
003:    This file is part of the GNU C Library.
004: 
005:    The GNU C Library is free software; you can redistribute it and/or
006:    modify it under the terms of the GNU Lesser General Public
007:    License as published by the Free Software Foundation; either
008:    version 2.1 of the License, or (at your option) any later version.
009: 
010:    The GNU C Library is distributed in the hope that it will be useful,
011:    but WITHOUT ANY WARRANTY; without even the implied warranty of
012:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:    Lesser General Public License for more details.
014: 
015:    You should have received a copy of the GNU Lesser General Public
016:    License along with the GNU C Library; if not, write to the Free
017:    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
018:    02111-1307 USA.  */
019: 
020: /*
021:  *      ISO C99 Standard: 7.22 Type-generic math        <tgmath.h>
022:  */
023: 
024: #ifndef _TGMATH_H
025: #define _TGMATH_H       1
026: 
027: /* Include the needed headers.  */
028: #include <math.h>
029: #include <complex.h>
030: 
031: 
032: /* Since `complex' is currently not really implemented in most C compilers
033:    and if it is implemented, the implementations differ.  This makes it
034:    quite difficult to write a generic implementation of this header.  We
035:    do not try this for now and instead concentrate only on GNU CC.  Once
036:    we have more information support for other compilers might follow.  */
037: 
038: #if __GNUC_PREREQ (2, 7)
039: 
040: # ifdef __NO_LONG_DOUBLE_MATH
041: #  define __tgml(fct) fct
042: # else
043: #  define __tgml(fct) fct ## l
044: # endif
045: 
046: /* This is ugly but unless gcc gets appropriate builtins we have to do
047:    something like this.  Don't ask how it works.  */
048: 
049: /* 1 if 'type' is a floating type, 0 if 'type' is an integer type.
050:    Allows for _Bool.  Expands to an integer constant expression.  */
051: # if __GNUC_PREREQ (3, 1)
052: #  define __floating_type(type) \
053:   (__builtin_classify_type ((type) 0) == 8 \
054:    || (__builtin_classify_type ((type) 0) == 9 \
055:        && __builtin_classify_type (__real__ ((type) 0)) == 8))
056: # else
057: #  define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))
058: # endif
059: 
060: /* The tgmath real type for T, where E is 0 if T is an integer type and
061:    1 for a floating type.  */
062: # define __tgmath_real_type_sub(T, E) \
063:   __typeof__ (*(0 ? (__typeof__ (0 ? (double *) 0 : (void *) (E))) 0          \
064:                   : (__typeof__ (0 ? (T *) 0 : (void *) (!(E)))) 0))
065: 
066: /* The tgmath real type of EXPR.  */
067: # define __tgmath_real_type(expr) \
068:   __tgmath_real_type_sub (__typeof__ ((__typeof__ (expr)) 0),                 \
069:                           __floating_type (__typeof__ (expr)))
070: 
071: 
072: /* We have two kinds of generic macros: to support functions which are
073:    only defined on real valued parameters and those which are defined
074:    for complex functions as well.  */
075: # define __TGMATH_UNARY_REAL_ONLY(Val, Fct) \
076:      (__extension__ ((sizeof (Val) == sizeof (double)                         \
077:                       || __builtin_classify_type (Val) != 8)                  \
078:                      ? (__tgmath_real_type (Val)) Fct (Val)                   \
079:                      : (sizeof (Val) == sizeof (float))                       \
080:                      ? (__tgmath_real_type (Val)) Fct##f (Val)                \
081:                      : (__tgmath_real_type (Val)) __tgml(Fct) (Val)))
082: 
083: # define __TGMATH_UNARY_REAL_RET_ONLY(Val, RetType, Fct) \
084:      (__extension__ ((sizeof (Val) == sizeof (double)                         \
085:                       || __builtin_classify_type (Val) != 8)                  \
086:                      ? (RetType) Fct (Val)                                    \
087:                      : (sizeof (Val) == sizeof (float))                       \
088:                      ? (RetType) Fct##f (Val)                                 \
089:                      : (RetType) __tgml(Fct) (Val)))
090: 
091: # define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \
092:      (__extension__ ((sizeof (Val1) == sizeof (double)                        \
093:                       || __builtin_classify_type (Val1) != 8)                 \
094:                      ? (__tgmath_real_type (Val1)) Fct (Val1, Val2)           \
095:                      : (sizeof (Val1) == sizeof (float))                      \
096:                      ? (__tgmath_real_type (Val1)) Fct##f (Val1, Val2)        \
097:                      : (__tgmath_real_type (Val1)) __tgml(Fct) (Val1, Val2)))
098: 
099: # define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \
100:      (__extension__ (((sizeof (Val1) > sizeof (double)                        \
101:                        || sizeof (Val2) > sizeof (double))                    \
102:                       && __builtin_classify_type ((Val1) + (Val2)) == 8)      \
103:                      ? (__typeof ((__tgmath_real_type (Val1)) 0               \
104:                                    + (__tgmath_real_type (Val2)) 0))          \
105:                        __tgml(Fct) (Val1, Val2)                               \
106:                      : (sizeof (Val1) == sizeof (double)                      \
107:                         || sizeof (Val2) == sizeof (double)                   \
108:                         || __builtin_classify_type (Val1) != 8                \
109:                         || __builtin_classify_type (Val2) != 8)               \
110:                      ? (__typeof ((__tgmath_real_type (Val1)) 0               \
111:                                    + (__tgmath_real_type (Val2)) 0))          \
112:                        Fct (Val1, Val2)                                       \
113:                      : (__typeof ((__tgmath_real_type (Val1)) 0               \
114:                                    + (__tgmath_real_type (Val2)) 0))          \
115:                        Fct##f (Val1, Val2)))
116: 
117: # define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
118:      (__extension__ (((sizeof (Val1) > sizeof (double)                        \
119:                        || sizeof (Val2) > sizeof (double))                    \
120:                       && __builtin_classify_type ((Val1) + (Val2)) == 8)      \
121:                      ? (__typeof ((__tgmath_real_type (Val1)) 0               \
122:                                    + (__tgmath_real_type (Val2)) 0))          \
123:                        __tgml(Fct) (Val1, Val2, Val3)                         \
124:                      : (sizeof (Val1) == sizeof (double)                      \
125:                         || sizeof (Val2) == sizeof (double)                   \
126:                         || __builtin_classify_type (Val1) != 8                \
127:                         || __builtin_classify_type (Val2) != 8)               \
128:                      ? (__typeof ((__tgmath_real_type (Val1)) 0               \
129:                                    + (__tgmath_real_type (Val2)) 0))          \
130:                        Fct (Val1, Val2, Val3)                                 \
131:                      : (__typeof ((__tgmath_real_type (Val1)) 0               \
132:                                    + (__tgmath_real_type (Val2)) 0))          \
133:                        Fct##f (Val1, Val2, Val3)))
134: 
135: # define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct) \
136:      (__extension__ (((sizeof (Val1) > sizeof (double)                        \
137:                        || sizeof (Val2) > sizeof (double)                     \
138:                        || sizeof (Val3) > sizeof (double))                    \
139:                       && __builtin_classify_type ((Val1) + (Val2) + (Val3))   \
140:                          == 8)                                                \
141:                      ? (__typeof ((__tgmath_real_type (Val1)) 0               \
142:                                    + (__tgmath_real_type (Val2)) 0            \
143:                                    + (__tgmath_real_type (Val3)) 0))          \
144:                        __tgml(Fct) (Val1, Val2, Val3)                         \
145:                      : (sizeof (Val1) == sizeof (double)                      \
146:                         || sizeof (Val2) == sizeof (double)                   \
147:                         || sizeof (Val3) == sizeof (double)                   \
148:                         || __builtin_classify_type (Val1) != 8                \
149:                         || __builtin_classify_type (Val2) != 8                \
150:                         || __builtin_classify_type (Val3) != 8)               \
151:                      ? (__typeof ((__tgmath_real_type (Val1)) 0               \
152:                                    + (__tgmath_real_type (Val2)) 0            \
153:                                    + (__tgmath_real_type (Val3)) 0))          \
154:                        Fct (Val1, Val2, Val3)                                 \
155:                      : (__typeof ((__tgmath_real_type (Val1)) 0               \
156:                                    + (__tgmath_real_type (Val2)) 0            \
157:                                    + (__tgmath_real_type (Val3)) 0))          \
158:                        Fct##f (Val1, Val2, Val3)))
159: 
160: /* XXX This definition has to be changed as soon as the compiler understands
161:    the imaginary keyword.  */
162: # define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct) \
163:      (__extension__ ((sizeof (__real__ (Val)) == sizeof (double)              \
164:                       || __builtin_classify_type (__real__ (Val)) != 8)       \
165:                      ? ((sizeof (__real__ (Val)) == sizeof (Val))             \
166:                         ? (__tgmath_real_type (Val)) Fct (Val)                \
167:                         : (__tgmath_real_type (Val)) Cfct (Val))              \
168:                      : (sizeof (__real__ (Val)) == sizeof (float))            \
169:                      ? ((sizeof (__real__ (Val)) == sizeof (Val))             \
170:                         ? (__tgmath_real_type (Val)) Fct##f (Val)             \
171:                         : (__tgmath_real_type (Val)) Cfct##f (Val))           \
172:                      : ((sizeof (__real__ (Val)) == sizeof (Val))             \
173:                         ? (__tgmath_real_type (Val)) __tgml(Fct) (Val)        \
174:                         : (__tgmath_real_type (Val)) __tgml(Cfct) (Val))))
175: 
176: # define __TGMATH_UNARY_IMAG(Val, Cfct) \
177:      (__extension__ ((sizeof (__real__ (Val)) == sizeof (double)              \
178:                       || __builtin_classify_type (__real__ (Val)) != 8)       \
179:                      ? (__typeof__ ((__tgmath_real_type (Val)) 0              \
180:                                     + _Complex_I)) Cfct (Val)                 \
181:                      : (sizeof (__real__ (Val)) == sizeof (float))            \
182:                      ? (__typeof__ ((__tgmath_real_type (Val)) 0              \
183:                                     + _Complex_I)) Cfct##f (Val)              \
184:                      : (__typeof__ ((__tgmath_real_type (Val)) 0              \
185:                                     + _Complex_I)) __tgml(Cfct) (Val)))
186: 
187: /* XXX This definition has to be changed as soon as the compiler understands
188:    the imaginary keyword.  */
189: # define __TGMATH_UNARY_REAL_IMAG_RET_REAL(Val, Fct, Cfct) \
190:      (__extension__ ((sizeof (__real__ (Val)) == sizeof (double)              \
191:                       || __builtin_classify_type (__real__ (Val)) != 8)       \
192:                      ? ((sizeof (__real__ (Val)) == sizeof (Val))             \
193:                         ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
194:                           Fct (Val)                                           \
195:                         : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
196:                           Cfct (Val))                                         \
197:                      : (sizeof (__real__ (Val)) == sizeof (float))            \
198:                      ? ((sizeof (__real__ (Val)) == sizeof (Val))             \
199:                         ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
200:                           Fct##f (Val)                                        \
201:                         : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
202:                           Cfct##f (Val))                                      \
203:                      : ((sizeof (__real__ (Val)) == sizeof (Val))             \
204:                         ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
205:                           __tgml(Fct) (Val)                                   \
206:                         : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
207:                           __tgml(Cfct) (Val))))
208: 
209: /* XXX This definition has to be changed as soon as the compiler understands
210:    the imaginary keyword.  */
211: # define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \
212:      (__extension__ (((sizeof (__real__ (Val1)) > sizeof (double)             \
213:                        || sizeof (__real__ (Val2)) > sizeof (double))         \
214:                       && __builtin_classify_type (__real__ (Val1)             \
215:                                                   + __real__ (Val2)) == 8)    \
216:                      ? ((sizeof (__real__ (Val1)) == sizeof (Val1)            \
217:                          && sizeof (__real__ (Val2)) == sizeof (Val2))        \
218:                         ? (__typeof ((__tgmath_real_type (Val1)) 0            \
219:                                    + (__tgmath_real_type (Val2)) 0))          \
220:                           __tgml(Fct) (Val1, Val2)                            \
221:                         : (__typeof ((__tgmath_real_type (Val1)) 0            \
222:                                    + (__tgmath_real_type (Val2)) 0))          \
223:                           __tgml(Cfct) (Val1, Val2))                          \
224:                      : (sizeof (__real__ (Val1)) == sizeof (double)           \
225:                         || sizeof (__real__ (Val2)) == sizeof (double)        \
226:                         || __builtin_classify_type (__real__ (Val1)) != 8     \
227:                         || __builtin_classify_type (__real__ (Val2)) != 8)    \
228:                      ? ((sizeof (__real__ (Val1)) == sizeof (Val1)            \
229:                          && sizeof (__real__ (Val2)) == sizeof (Val2))        \
230:                         ? (__typeof ((__tgmath_real_type (Val1)) 0            \
231:                                    + (__tgmath_real_type (Val2)) 0))          \
232:                           Fct (Val1, Val2)                                    \
233:                         : (__typeof ((__tgmath_real_type (Val1)) 0            \
234:                                    + (__tgmath_real_type (Val2)) 0))          \
235:                           Cfct (Val1, Val2))                                  \
236:                      : ((sizeof (__real__ (Val1)) == sizeof (Val1)            \
237:                          && sizeof (__real__ (Val2)) == sizeof (Val2))        \
238:                         ? (__typeof ((__tgmath_real_type (Val1)) 0            \
239:                                    + (__tgmath_real_type (Val2)) 0))          \
240:                           Fct##f (Val1, Val2)                                 \
241:                         : (__typeof ((__tgmath_real_type (Val1)) 0            \
242:                                    + (__tgmath_real_type (Val2)) 0))          \
243:                           Cfct##f (Val1, Val2))))
244: #else
245: # error "Unsupported compiler; you cannot use <tgmath.h>"
246: #endif
247: 
248: 
249: /* Unary functions defined for real and complex values.  */
250: 
251: 
252: /* Trigonometric functions.  */
253: 
254: /* Arc cosine of X.  */
255: #define acos(Val) __TGMATH_UNARY_REAL_IMAG (Val, acos, cacos)
256: /* Arc sine of X.  */
257: #define asin(Val) __TGMATH_UNARY_REAL_IMAG (Val, asin, casin)
258: /* Arc tangent of X.  */
259: #define atan(Val) __TGMATH_UNARY_REAL_IMAG (Val, atan, catan)
260: /* Arc tangent of Y/X.  */
261: #define atan2(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, atan2)
262: 
263: /* Cosine of X.  */
264: #define cos(Val) __TGMATH_UNARY_REAL_IMAG (Val, cos, ccos)
265: /* Sine of X.  */
266: #define sin(Val) __TGMATH_UNARY_REAL_IMAG (Val, sin, csin)
267: /* Tangent of X.  */
268: #define tan(Val) __TGMATH_UNARY_REAL_IMAG (Val, tan, ctan)
269: 
270: 
271: /* Hyperbolic functions.  */
272: 
273: /* Hyperbolic arc cosine of X.  */
274: #define acosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, acosh, cacosh)
275: /* Hyperbolic arc sine of X.  */
276: #define asinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, asinh, casinh)
277: /* Hyperbolic arc tangent of X.  */
278: #define atanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, atanh, catanh)
279: 
280: /* Hyperbolic cosine of X.  */
281: #define cosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, cosh, ccosh)
282: /* Hyperbolic sine of X.  */
283: #define sinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, sinh, csinh)
284: /* Hyperbolic tangent of X.  */
285: #define tanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, tanh, ctanh)
286: 
287: 
288: /* Exponential and logarithmic functions.  */
289: 
290: /* Exponential function of X.  */
291: #define exp(Val) __TGMATH_UNARY_REAL_IMAG (Val, exp, cexp)
292: 
293: /* Break VALUE into a normalized fraction and an integral power of 2.  */
294: #define frexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, frexp)
295: 
296: /* X times (two to the EXP power).  */
297: #define ldexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, ldexp)
298: 
299: /* Natural logarithm of X.  */
300: #define log(Val) __TGMATH_UNARY_REAL_IMAG (Val, log, clog)
301: 
302: /* Base-ten logarithm of X.  */
303: #ifdef __USE_GNU
304: # define log10(Val) __TGMATH_UNARY_REAL_IMAG (Val, log10, __clog10)
305: #else
306: # define log10(Val) __TGMATH_UNARY_REAL_ONLY (Val, log10)
307: #endif
308: 
309: /* Return exp(X) - 1.  */
310: #define expm1(Val) __TGMATH_UNARY_REAL_ONLY (Val, expm1)
311: 
312: /* Return log(1 + X).  */
313: #define log1p(Val) __TGMATH_UNARY_REAL_ONLY (Val, log1p)
314: 
315: /* Return the base 2 signed integral exponent of X.  */
316: #define logb(Val) __TGMATH_UNARY_REAL_ONLY (Val, logb)
317: 
318: /* Compute base-2 exponential of X.  */
319: #define exp2(Val) __TGMATH_UNARY_REAL_ONLY (Val, exp2)
320: 
321: /* Compute base-2 logarithm of X.  */
322: #define log2(Val) __TGMATH_UNARY_REAL_ONLY (Val, log2)
323: 
324: 
325: /* Power functions.  */
326: 
327: /* Return X to the Y power.  */
328: #define pow(Val1, Val2) __TGMATH_BINARY_REAL_IMAG (Val1, Val2, pow, cpow)
329: 
330: /* Return the square root of X.  */
331: #define sqrt(Val) __TGMATH_UNARY_REAL_IMAG (Val, sqrt, csqrt)
332: 
333: /* Return `sqrt(X*X + Y*Y)'.  */
334: #define hypot(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, hypot)
335: 
336: /* Return the cube root of X.  */
337: #define cbrt(Val) __TGMATH_UNARY_REAL_ONLY (Val, cbrt)
338: 
339: 
340: /* Nearest integer, absolute value, and remainder functions.  */
341: 
342: /* Smallest integral value not less than X.  */
343: #define ceil(Val) __TGMATH_UNARY_REAL_ONLY (Val, ceil)
344: 
345: /* Absolute value of X.  */
346: #define fabs(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, fabs, cabs)
347: 
348: /* Largest integer not greater than X.  */
349: #define floor(Val) __TGMATH_UNARY_REAL_ONLY (Val, floor)
350: 
351: /* Floating-point modulo remainder of X/Y.  */
352: #define fmod(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmod)
353: 
354: /* Round X to integral valuein floating-point format using current
355:    rounding direction, but do not raise inexact exception.  */
356: #define nearbyint(Val) __TGMATH_UNARY_REAL_ONLY (Val, nearbyint)
357: 
358: /* Round X to nearest integral value, rounding halfway cases away from
359:    zero.  */
360: #define round(Val) __TGMATH_UNARY_REAL_ONLY (Val, round)
361: 
362: /* Round X to the integral value in floating-point format nearest but
363:    not larger in magnitude.  */
364: #define trunc(Val) __TGMATH_UNARY_REAL_ONLY (Val, trunc)
365: 
366: /* Compute remainder of X and Y and put in *QUO a value with sign of x/y
367:    and magnitude congruent `mod 2^n' to the magnitude of the integral
368:    quotient x/y, with n >= 3.  */
369: #define remquo(Val1, Val2, Val3) \
370:      __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY (Val1, Val2, Val3, remquo)
371: 
372: /* Round X to nearest integral value according to current rounding
373:    direction.  */
374: #define lrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, lrint)
375: #define llrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long long int, llrint)
376: 
377: /* Round X to nearest integral value, rounding halfway cases away from
378:    zero.  */
379: #define lround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, lround)
380: #define llround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long long int, llround)
381: 
382: 
383: /* Return X with its signed changed to Y's.  */
384: #define copysign(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, copysign)
385: 
386: /* Error and gamma functions.  */
387: #define erf(Val) __TGMATH_UNARY_REAL_ONLY (Val, erf)
388: #define erfc(Val) __TGMATH_UNARY_REAL_ONLY (Val, erfc)
389: #define tgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, tgamma)
390: #define lgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, lgamma)
391: 
392: 
393: /* Return the integer nearest X in the direction of the
394:    prevailing rounding mode.  */
395: #define rint(Val) __TGMATH_UNARY_REAL_ONLY (Val, rint)
396: 
397: /* Return X + epsilon if X < Y, X - epsilon if X > Y.  */
398: #define nextafter(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, nextafter)
399: #define nexttoward(Val1, Val2) \
400:      __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, nexttoward)
401: 
402: /* Return the remainder of integer divison X / Y with infinite precision.  */
403: #define remainder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, remainder)
404: 
405: /* Return X times (2 to the Nth power).  */
406: #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
407: # define scalb(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, scalb)
408: #endif
409: 
410: /* Return X times (2 to the Nth power).  */
411: #define scalbn(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbn)
412: 
413: /* Return X times (2 to the Nth power).  */
414: #define scalbln(Val1, Val2) \
415:      __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbln)
416: 
417: /* Return the binary exponent of X, which must be nonzero.  */
418: #define ilogb(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, int, ilogb)
419: 
420: 
421: /* Return positive difference between X and Y.  */
422: #define fdim(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fdim)
423: 
424: /* Return maximum numeric value from X and Y.  */
425: #define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax)
426: 
427: /* Return minimum numeric value from X and Y.  */
428: #define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin)
429: 
430: 
431: /* Multiply-add function computed as a ternary operation.  */
432: #define fma(Val1, Val2, Val3) \
433:      __TGMATH_TERNARY_REAL_ONLY (Val1, Val2, Val3, fma)
434: 
435: 
436: /* Absolute value, conjugates, and projection.  */
437: 
438: /* Argument value of Z.  */
439: #define carg(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, carg, carg)
440: 
441: /* Complex conjugate of Z.  */
442: #define conj(Val) __TGMATH_UNARY_IMAG (Val, conj)
443: 
444: /* Projection of Z onto the Riemann sphere.  */
445: #define cproj(Val) __TGMATH_UNARY_IMAG (Val, cproj)
446: 
447: 
448: /* Decomposing complex values.  */
449: 
450: /* Imaginary part of Z.  */
451: #define cimag(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, cimag, cimag)
452: 
453: /* Real part of Z.  */
454: #define creal(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, creal, creal)
455: 
456: #endif /* tgmath.h */
457: 


for client 18.221.174.248
© Andrew Scott 2006 - 2024,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/