Back to index

glibc  2.9
tgmath.h
Go to the documentation of this file.
00001 /* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007
00002    Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 /*
00021  *     ISO C99 Standard: 7.22 Type-generic math  <tgmath.h>
00022  */
00023 
00024 #ifndef _TGMATH_H
00025 #define _TGMATH_H    1
00026 
00027 /* Include the needed headers.  */
00028 #include <math.h>
00029 #include <complex.h>
00030 
00031 
00032 /* Since `complex' is currently not really implemented in most C compilers
00033    and if it is implemented, the implementations differ.  This makes it
00034    quite difficult to write a generic implementation of this header.  We
00035    do not try this for now and instead concentrate only on GNU CC.  Once
00036    we have more information support for other compilers might follow.  */
00037 
00038 #if __GNUC_PREREQ (2, 7)
00039 
00040 # ifdef __NO_LONG_DOUBLE_MATH
00041 #  define __tgml(fct) fct
00042 # else
00043 #  define __tgml(fct) fct ## l
00044 # endif
00045 
00046 /* This is ugly but unless gcc gets appropriate builtins we have to do
00047    something like this.  Don't ask how it works.  */
00048 
00049 /* 1 if 'type' is a floating type, 0 if 'type' is an integer type.
00050    Allows for _Bool.  Expands to an integer constant expression.  */
00051 # if __GNUC_PREREQ (3, 1)
00052 #  define __floating_type(type) \
00053   (__builtin_classify_type ((type) 0) == 8 \
00054    || (__builtin_classify_type ((type) 0) == 9 \
00055        && __builtin_classify_type (__real__ ((type) 0)) == 8))
00056 # else
00057 #  define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))
00058 # endif
00059 
00060 /* The tgmath real type for T, where E is 0 if T is an integer type and
00061    1 for a floating type.  */
00062 # define __tgmath_real_type_sub(T, E) \
00063   __typeof__ (*(0 ? (__typeof__ (0 ? (double *) 0 : (void *) (E))) 0        \
00064                 : (__typeof__ (0 ? (T *) 0 : (void *) (!(E)))) 0))
00065 
00066 /* The tgmath real type of EXPR.  */
00067 # define __tgmath_real_type(expr) \
00068   __tgmath_real_type_sub (__typeof__ ((__typeof__ (expr)) 0),               \
00069                        __floating_type (__typeof__ (expr)))
00070 
00071 
00072 /* We have two kinds of generic macros: to support functions which are
00073    only defined on real valued parameters and those which are defined
00074    for complex functions as well.  */
00075 # define __TGMATH_UNARY_REAL_ONLY(Val, Fct) \
00076      (__extension__ ((sizeof (Val) == sizeof (double)                       \
00077                     || __builtin_classify_type (Val) != 8)                  \
00078                    ? (__tgmath_real_type (Val)) Fct (Val)                   \
00079                    : (sizeof (Val) == sizeof (float))                       \
00080                    ? (__tgmath_real_type (Val)) Fct##f (Val)                \
00081                    : (__tgmath_real_type (Val)) __tgml(Fct) (Val)))
00082 
00083 # define __TGMATH_UNARY_REAL_RET_ONLY(Val, RetType, Fct) \
00084      (__extension__ ((sizeof (Val) == sizeof (double)                       \
00085                     || __builtin_classify_type (Val) != 8)                  \
00086                    ? (RetType) Fct (Val)                             \
00087                    : (sizeof (Val) == sizeof (float))                       \
00088                    ? (RetType) Fct##f (Val)                                 \
00089                    : (RetType) __tgml(Fct) (Val)))
00090 
00091 # define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \
00092      (__extension__ ((sizeof (Val1) == sizeof (double)                      \
00093                     || __builtin_classify_type (Val1) != 8)                 \
00094                    ? (__tgmath_real_type (Val1)) Fct (Val1, Val2)           \
00095                    : (sizeof (Val1) == sizeof (float))               \
00096                    ? (__tgmath_real_type (Val1)) Fct##f (Val1, Val2)        \
00097                    : (__tgmath_real_type (Val1)) __tgml(Fct) (Val1, Val2)))
00098 
00099 # define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \
00100      (__extension__ (((sizeof (Val1) > sizeof (double)                      \
00101                      || sizeof (Val2) > sizeof (double))                    \
00102                     && __builtin_classify_type ((Val1) + (Val2)) == 8)      \
00103                    ? (__typeof ((__tgmath_real_type (Val1)) 0               \
00104                                + (__tgmath_real_type (Val2)) 0))            \
00105                      __tgml(Fct) (Val1, Val2)                               \
00106                    : (sizeof (Val1) == sizeof (double)               \
00107                      || sizeof (Val2) == sizeof (double)                    \
00108                      || __builtin_classify_type (Val1) != 8                 \
00109                      || __builtin_classify_type (Val2) != 8)                \
00110                    ? (__typeof ((__tgmath_real_type (Val1)) 0               \
00111                                + (__tgmath_real_type (Val2)) 0))            \
00112                      Fct (Val1, Val2)                                       \
00113                    : (__typeof ((__tgmath_real_type (Val1)) 0               \
00114                                + (__tgmath_real_type (Val2)) 0))            \
00115                      Fct##f (Val1, Val2)))
00116 
00117 # define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
00118      (__extension__ (((sizeof (Val1) > sizeof (double)                      \
00119                      || sizeof (Val2) > sizeof (double))                    \
00120                     && __builtin_classify_type ((Val1) + (Val2)) == 8)      \
00121                    ? (__typeof ((__tgmath_real_type (Val1)) 0               \
00122                                + (__tgmath_real_type (Val2)) 0))            \
00123                      __tgml(Fct) (Val1, Val2, Val3)                         \
00124                    : (sizeof (Val1) == sizeof (double)               \
00125                      || sizeof (Val2) == sizeof (double)                    \
00126                      || __builtin_classify_type (Val1) != 8                 \
00127                      || __builtin_classify_type (Val2) != 8)                \
00128                    ? (__typeof ((__tgmath_real_type (Val1)) 0               \
00129                                + (__tgmath_real_type (Val2)) 0))            \
00130                      Fct (Val1, Val2, Val3)                                 \
00131                    : (__typeof ((__tgmath_real_type (Val1)) 0               \
00132                                + (__tgmath_real_type (Val2)) 0))            \
00133                      Fct##f (Val1, Val2, Val3)))
00134 
00135 # define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct) \
00136      (__extension__ (((sizeof (Val1) > sizeof (double)                      \
00137                      || sizeof (Val2) > sizeof (double)              \
00138                      || sizeof (Val3) > sizeof (double))                    \
00139                     && __builtin_classify_type ((Val1) + (Val2) + (Val3))   \
00140                       == 8)                                          \
00141                    ? (__typeof ((__tgmath_real_type (Val1)) 0               \
00142                                + (__tgmath_real_type (Val2)) 0       \
00143                                + (__tgmath_real_type (Val3)) 0))            \
00144                      __tgml(Fct) (Val1, Val2, Val3)                         \
00145                    : (sizeof (Val1) == sizeof (double)               \
00146                      || sizeof (Val2) == sizeof (double)                    \
00147                      || sizeof (Val3) == sizeof (double)                    \
00148                      || __builtin_classify_type (Val1) != 8                 \
00149                      || __builtin_classify_type (Val2) != 8                 \
00150                      || __builtin_classify_type (Val3) != 8)                \
00151                    ? (__typeof ((__tgmath_real_type (Val1)) 0               \
00152                                + (__tgmath_real_type (Val2)) 0       \
00153                                + (__tgmath_real_type (Val3)) 0))            \
00154                      Fct (Val1, Val2, Val3)                                 \
00155                    : (__typeof ((__tgmath_real_type (Val1)) 0               \
00156                                + (__tgmath_real_type (Val2)) 0       \
00157                                + (__tgmath_real_type (Val3)) 0))            \
00158                      Fct##f (Val1, Val2, Val3)))
00159 
00160 /* XXX This definition has to be changed as soon as the compiler understands
00161    the imaginary keyword.  */
00162 # define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct) \
00163      (__extension__ ((sizeof (__real__ (Val)) == sizeof (double)            \
00164                     || __builtin_classify_type (__real__ (Val)) != 8)       \
00165                    ? ((sizeof (__real__ (Val)) == sizeof (Val))             \
00166                      ? (__tgmath_real_type (Val)) Fct (Val)                 \
00167                      : (__tgmath_real_type (Val)) Cfct (Val))        \
00168                    : (sizeof (__real__ (Val)) == sizeof (float))            \
00169                    ? ((sizeof (__real__ (Val)) == sizeof (Val))             \
00170                      ? (__tgmath_real_type (Val)) Fct##f (Val)       \
00171                      : (__tgmath_real_type (Val)) Cfct##f (Val))            \
00172                    : ((sizeof (__real__ (Val)) == sizeof (Val))             \
00173                      ? (__tgmath_real_type (Val)) __tgml(Fct) (Val)         \
00174                      : (__tgmath_real_type (Val)) __tgml(Cfct) (Val))))
00175 
00176 # define __TGMATH_UNARY_IMAG(Val, Cfct) \
00177      (__extension__ ((sizeof (__real__ (Val)) == sizeof (double)            \
00178                     || __builtin_classify_type (__real__ (Val)) != 8)       \
00179                    ? (__typeof__ ((__tgmath_real_type (Val)) 0       \
00180                                 + _Complex_I)) Cfct (Val)                   \
00181                    : (sizeof (__real__ (Val)) == sizeof (float))            \
00182                    ? (__typeof__ ((__tgmath_real_type (Val)) 0       \
00183                                 + _Complex_I)) Cfct##f (Val)         \
00184                    : (__typeof__ ((__tgmath_real_type (Val)) 0       \
00185                                 + _Complex_I)) __tgml(Cfct) (Val)))
00186 
00187 /* XXX This definition has to be changed as soon as the compiler understands
00188    the imaginary keyword.  */
00189 # define __TGMATH_UNARY_REAL_IMAG_RET_REAL(Val, Fct, Cfct) \
00190      (__extension__ ((sizeof (__real__ (Val)) == sizeof (double)            \
00191                     || __builtin_classify_type (__real__ (Val)) != 8)       \
00192                    ? ((sizeof (__real__ (Val)) == sizeof (Val))             \
00193                      ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
00194                        Fct (Val)                                     \
00195                      : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
00196                        Cfct (Val))                                   \
00197                    : (sizeof (__real__ (Val)) == sizeof (float))            \
00198                    ? ((sizeof (__real__ (Val)) == sizeof (Val))             \
00199                      ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
00200                        Fct##f (Val)                                         \
00201                      : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
00202                        Cfct##f (Val))                                \
00203                    : ((sizeof (__real__ (Val)) == sizeof (Val))             \
00204                      ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
00205                        __tgml(Fct) (Val)                             \
00206                      : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
00207                        __tgml(Cfct) (Val))))
00208 
00209 /* XXX This definition has to be changed as soon as the compiler understands
00210    the imaginary keyword.  */
00211 # define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \
00212      (__extension__ (((sizeof (__real__ (Val1)) > sizeof (double)           \
00213                      || sizeof (__real__ (Val2)) > sizeof (double))         \
00214                     && __builtin_classify_type (__real__ (Val1)             \
00215                                             + __real__ (Val2)) == 8)    \
00216                    ? ((sizeof (__real__ (Val1)) == sizeof (Val1)            \
00217                       && sizeof (__real__ (Val2)) == sizeof (Val2))         \
00218                      ? (__typeof ((__tgmath_real_type (Val1)) 0             \
00219                                + (__tgmath_real_type (Val2)) 0))            \
00220                        __tgml(Fct) (Val1, Val2)                      \
00221                      : (__typeof ((__tgmath_real_type (Val1)) 0             \
00222                                + (__tgmath_real_type (Val2)) 0))            \
00223                        __tgml(Cfct) (Val1, Val2))                           \
00224                    : (sizeof (__real__ (Val1)) == sizeof (double)           \
00225                      || sizeof (__real__ (Val2)) == sizeof (double)         \
00226                      || __builtin_classify_type (__real__ (Val1)) != 8     \
00227                      || __builtin_classify_type (__real__ (Val2)) != 8)    \
00228                    ? ((sizeof (__real__ (Val1)) == sizeof (Val1)            \
00229                       && sizeof (__real__ (Val2)) == sizeof (Val2))         \
00230                      ? (__typeof ((__tgmath_real_type (Val1)) 0             \
00231                                + (__tgmath_real_type (Val2)) 0))            \
00232                        Fct (Val1, Val2)                              \
00233                      : (__typeof ((__tgmath_real_type (Val1)) 0             \
00234                                + (__tgmath_real_type (Val2)) 0))            \
00235                        Cfct (Val1, Val2))                            \
00236                    : ((sizeof (__real__ (Val1)) == sizeof (Val1)            \
00237                       && sizeof (__real__ (Val2)) == sizeof (Val2))         \
00238                      ? (__typeof ((__tgmath_real_type (Val1)) 0             \
00239                                + (__tgmath_real_type (Val2)) 0))            \
00240                        Fct##f (Val1, Val2)                                  \
00241                      : (__typeof ((__tgmath_real_type (Val1)) 0             \
00242                                + (__tgmath_real_type (Val2)) 0))            \
00243                        Cfct##f (Val1, Val2))))
00244 #else
00245 # error "Unsupported compiler; you cannot use <tgmath.h>"
00246 #endif
00247 
00248 
00249 /* Unary functions defined for real and complex values.  */
00250 
00251 
00252 /* Trigonometric functions.  */
00253 
00254 /* Arc cosine of X.  */
00255 #define acos(Val) __TGMATH_UNARY_REAL_IMAG (Val, acos, cacos)
00256 /* Arc sine of X.  */
00257 #define asin(Val) __TGMATH_UNARY_REAL_IMAG (Val, asin, casin)
00258 /* Arc tangent of X.  */
00259 #define atan(Val) __TGMATH_UNARY_REAL_IMAG (Val, atan, catan)
00260 /* Arc tangent of Y/X.  */
00261 #define atan2(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, atan2)
00262 
00263 /* Cosine of X.  */
00264 #define cos(Val) __TGMATH_UNARY_REAL_IMAG (Val, cos, ccos)
00265 /* Sine of X.  */
00266 #define sin(Val) __TGMATH_UNARY_REAL_IMAG (Val, sin, csin)
00267 /* Tangent of X.  */
00268 #define tan(Val) __TGMATH_UNARY_REAL_IMAG (Val, tan, ctan)
00269 
00270 
00271 /* Hyperbolic functions.  */
00272 
00273 /* Hyperbolic arc cosine of X.  */
00274 #define acosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, acosh, cacosh)
00275 /* Hyperbolic arc sine of X.  */
00276 #define asinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, asinh, casinh)
00277 /* Hyperbolic arc tangent of X.  */
00278 #define atanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, atanh, catanh)
00279 
00280 /* Hyperbolic cosine of X.  */
00281 #define cosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, cosh, ccosh)
00282 /* Hyperbolic sine of X.  */
00283 #define sinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, sinh, csinh)
00284 /* Hyperbolic tangent of X.  */
00285 #define tanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, tanh, ctanh)
00286 
00287 
00288 /* Exponential and logarithmic functions.  */
00289 
00290 /* Exponential function of X.  */
00291 #define exp(Val) __TGMATH_UNARY_REAL_IMAG (Val, exp, cexp)
00292 
00293 /* Break VALUE into a normalized fraction and an integral power of 2.  */
00294 #define frexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, frexp)
00295 
00296 /* X times (two to the EXP power).  */
00297 #define ldexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, ldexp)
00298 
00299 /* Natural logarithm of X.  */
00300 #define log(Val) __TGMATH_UNARY_REAL_IMAG (Val, log, clog)
00301 
00302 /* Base-ten logarithm of X.  */
00303 #ifdef __USE_GNU
00304 # define log10(Val) __TGMATH_UNARY_REAL_IMAG (Val, log10, __clog10)
00305 #else
00306 # define log10(Val) __TGMATH_UNARY_REAL_ONLY (Val, log10)
00307 #endif
00308 
00309 /* Return exp(X) - 1.  */
00310 #define expm1(Val) __TGMATH_UNARY_REAL_ONLY (Val, expm1)
00311 
00312 /* Return log(1 + X).  */
00313 #define log1p(Val) __TGMATH_UNARY_REAL_ONLY (Val, log1p)
00314 
00315 /* Return the base 2 signed integral exponent of X.  */
00316 #define logb(Val) __TGMATH_UNARY_REAL_ONLY (Val, logb)
00317 
00318 /* Compute base-2 exponential of X.  */
00319 #define exp2(Val) __TGMATH_UNARY_REAL_ONLY (Val, exp2)
00320 
00321 /* Compute base-2 logarithm of X.  */
00322 #define log2(Val) __TGMATH_UNARY_REAL_ONLY (Val, log2)
00323 
00324 
00325 /* Power functions.  */
00326 
00327 /* Return X to the Y power.  */
00328 #define pow(Val1, Val2) __TGMATH_BINARY_REAL_IMAG (Val1, Val2, pow, cpow)
00329 
00330 /* Return the square root of X.  */
00331 #define sqrt(Val) __TGMATH_UNARY_REAL_IMAG (Val, sqrt, csqrt)
00332 
00333 /* Return `sqrt(X*X + Y*Y)'.  */
00334 #define hypot(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, hypot)
00335 
00336 /* Return the cube root of X.  */
00337 #define cbrt(Val) __TGMATH_UNARY_REAL_ONLY (Val, cbrt)
00338 
00339 
00340 /* Nearest integer, absolute value, and remainder functions.  */
00341 
00342 /* Smallest integral value not less than X.  */
00343 #define ceil(Val) __TGMATH_UNARY_REAL_ONLY (Val, ceil)
00344 
00345 /* Absolute value of X.  */
00346 #define fabs(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, fabs, cabs)
00347 
00348 /* Largest integer not greater than X.  */
00349 #define floor(Val) __TGMATH_UNARY_REAL_ONLY (Val, floor)
00350 
00351 /* Floating-point modulo remainder of X/Y.  */
00352 #define fmod(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmod)
00353 
00354 /* Round X to integral valuein floating-point format using current
00355    rounding direction, but do not raise inexact exception.  */
00356 #define nearbyint(Val) __TGMATH_UNARY_REAL_ONLY (Val, nearbyint)
00357 
00358 /* Round X to nearest integral value, rounding halfway cases away from
00359    zero.  */
00360 #define round(Val) __TGMATH_UNARY_REAL_ONLY (Val, round)
00361 
00362 /* Round X to the integral value in floating-point format nearest but
00363    not larger in magnitude.  */
00364 #define trunc(Val) __TGMATH_UNARY_REAL_ONLY (Val, trunc)
00365 
00366 /* Compute remainder of X and Y and put in *QUO a value with sign of x/y
00367    and magnitude congruent `mod 2^n' to the magnitude of the integral
00368    quotient x/y, with n >= 3.  */
00369 #define remquo(Val1, Val2, Val3) \
00370      __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY (Val1, Val2, Val3, remquo)
00371 
00372 /* Round X to nearest integral value according to current rounding
00373    direction.  */
00374 #define lrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, lrint)
00375 #define llrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long long int, llrint)
00376 
00377 /* Round X to nearest integral value, rounding halfway cases away from
00378    zero.  */
00379 #define lround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, lround)
00380 #define llround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long long int, llround)
00381 
00382 
00383 /* Return X with its signed changed to Y's.  */
00384 #define copysign(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, copysign)
00385 
00386 /* Error and gamma functions.  */
00387 #define erf(Val) __TGMATH_UNARY_REAL_ONLY (Val, erf)
00388 #define erfc(Val) __TGMATH_UNARY_REAL_ONLY (Val, erfc)
00389 #define tgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, tgamma)
00390 #define lgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, lgamma)
00391 
00392 
00393 /* Return the integer nearest X in the direction of the
00394    prevailing rounding mode.  */
00395 #define rint(Val) __TGMATH_UNARY_REAL_ONLY (Val, rint)
00396 
00397 /* Return X + epsilon if X < Y, X - epsilon if X > Y.  */
00398 #define nextafter(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, nextafter)
00399 #define nexttoward(Val1, Val2) \
00400      __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, nexttoward)
00401 
00402 /* Return the remainder of integer divison X / Y with infinite precision.  */
00403 #define remainder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, remainder)
00404 
00405 /* Return X times (2 to the Nth power).  */
00406 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
00407 # define scalb(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, scalb)
00408 #endif
00409 
00410 /* Return X times (2 to the Nth power).  */
00411 #define scalbn(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbn)
00412 
00413 /* Return X times (2 to the Nth power).  */
00414 #define scalbln(Val1, Val2) \
00415      __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbln)
00416 
00417 /* Return the binary exponent of X, which must be nonzero.  */
00418 #define ilogb(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, int, ilogb)
00419 
00420 
00421 /* Return positive difference between X and Y.  */
00422 #define fdim(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fdim)
00423 
00424 /* Return maximum numeric value from X and Y.  */
00425 #define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax)
00426 
00427 /* Return minimum numeric value from X and Y.  */
00428 #define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin)
00429 
00430 
00431 /* Multiply-add function computed as a ternary operation.  */
00432 #define fma(Val1, Val2, Val3) \
00433      __TGMATH_TERNARY_REAL_ONLY (Val1, Val2, Val3, fma)
00434 
00435 
00436 /* Absolute value, conjugates, and projection.  */
00437 
00438 /* Argument value of Z.  */
00439 #define carg(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, carg, carg)
00440 
00441 /* Complex conjugate of Z.  */
00442 #define conj(Val) __TGMATH_UNARY_IMAG (Val, conj)
00443 
00444 /* Projection of Z onto the Riemann sphere.  */
00445 #define cproj(Val) __TGMATH_UNARY_IMAG (Val, cproj)
00446 
00447 
00448 /* Decomposing complex values.  */
00449 
00450 /* Imaginary part of Z.  */
00451 #define cimag(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, cimag, cimag)
00452 
00453 /* Real part of Z.  */
00454 #define creal(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, creal, creal)
00455 
00456 #endif /* tgmath.h */