This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
On Thu, Jan 25, 2001 at 04:04:21PM +0100, Andreas Jaeger wrote: > Jakub Jelinek <jakub@redhat.com> writes: > > > Hi! > > > > We have too many opening parens (resp. too few closing ones, your decision) > > which is a bad thing. > > Maybe we should cook up some test which will include tgmath.h and use all > > functions declared there just to make sure it can be compiled. > > Feel free to send a test - that would be quite usefull, Ouch, looks like a proper testcase is badly needed. Here is an updated patch with stuff I found out when trying to compile: #define _GNU_SOURCE #include <math.h> #include <tgmath.h> double x; void compile_test (void) { double a, b, c; int i; long int j; long long int k; a = cos (x); b = acos (a); a = sin (x); b = asin (a); a = tan (x); b = atan (a); c = atan2 (a, b); a = cosh (x); b = acosh (a); a = sinh (x); b = asinh (a); a = tanh (x); b = atanh (a); a = exp (x); b = log (a); a = log10 (x); b = ldexp (a, 5); a = frexp (x, &i); b = expm1 (a); a = log1p (x); b = logb (a); a = exp2 (x); b = log2 (a); a = pow (x, c); b = sqrt (a); a = hypot (x, c); b = cbrt (a); a = ceil (x); b = fabs (a); a = floor (x); b = fmod (a, c); a = nearbyint (x); b = round (a); a = trunc (x); b = remquo (a, c, &i); j = lrint (x) + lround (a); k = llrint (b) + llround (c); a = erf (x); b = erfc (a); a = tgamma (x); b = lgamma (a); a = rint (x); b = nextafter (a, c); a = nexttoward (x, c); b = remainder (a, c); a = scalb (x, 6); k = scalbn (a, 7) + scalbln (c, 10LL); i = ilogb (x); a = fdim (x, c); b = fmax (a, c); a = fmin (x, c); b = fma (a, x, c); } int main (void) { return 0; } The test should be probably extended quite a bit, so that it e.g. is compiled with all of float, double, long double, their __complex__ variants (where appropriate) and even trying various float, double and long double constants as arguments as well. 2001-01-25 Jakub Jelinek <jakub@redhat.com> * math/tgmath.h (__TGMATH_BINARY_FIRST_REAL_ONLY, __TGMATH_BINARY_REAL_ONLY, __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY, __TGMATH_TERNARY_REAL_ONLY): Use proper arguments to __builtin_classify_type, add ##f suffixes where appropriate. (__TGMATH_UNARY_REAL_IMAG): Remove extraneous left parenthesis. (__TGMATH_BINARY_REAL_IMAG): Likewise, use proper arguments to __builtin_classify_type. (fma): Fix spelling of first argument. --- libc/math/tgmath.h.jj Tue Aug 22 10:12:56 2000 +++ libc/math/tgmath.h Thu Jan 25 18:09:04 2001 @@ -71,7 +71,7 @@ # define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \ (__extension__ ({ __tgmath_real_type (Val1) __tgmres; \ if (sizeof (Val1) == sizeof (double) \ - || __builtin_classify_type (Val) != 8) \ + || __builtin_classify_type (Val1) != 8) \ __tgmres = Fct (Val1, Val2); \ else if (sizeof (Val1) == sizeof (float)) \ __tgmres = Fct##f (Val1, Val2); \ @@ -83,28 +83,30 @@ (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres; \ if ((sizeof (Val1) > sizeof (double) \ || sizeof (Val2) > sizeof (double)) \ - && __builtin_classify_type (Val) == 8) \ + && __builtin_classify_type ((Val1) + (Val2)) == 8) \ __tgmres = Fct##l (Val1, Val2); \ else if (sizeof (Val1) == sizeof (double) \ || sizeof (Val2) == sizeof (double) \ - || __builtin_classify_type (Val) != 8) \ + || __builtin_classify_type ((Val1) \ + + (Val2)) != 8) \ __tgmres = Fct (Val1, Val2); \ else \ - __tgmres = Fct (Val1, Val2); \ + __tgmres = Fct##f (Val1, Val2); \ __tgmres; })) # define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \ (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres; \ if ((sizeof (Val1) > sizeof (double) \ || sizeof (Val2) > sizeof (double)) \ - && __builtin_classify_type (Val) == 8) \ + && __builtin_classify_type ((Val1) + (Val2)) == 8) \ __tgmres = Fct##l (Val1, Val2, Val3); \ else if (sizeof (Val1) == sizeof (double) \ || sizeof (Val2) == sizeof (double) \ - || __builtin_classify_type (Val) != 8) \ + || __builtin_classify_type ((Val1) \ + + (Val2)) != 8) \ __tgmres = Fct (Val1, Val2, Val3); \ else \ - __tgmres = Fct (Val1, Val2, Val3); \ + __tgmres = Fct##f (Val1, Val2, Val3); \ __tgmres; })) # define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct) \ @@ -112,15 +114,17 @@ if ((sizeof (Val1) > sizeof (double) \ || sizeof (Val2) > sizeof (double) \ || sizeof (Val3) > sizeof (double)) \ - && __builtin_classify_type (Val) == 8) \ + && __builtin_classify_type ((Val1) + (Val2) \ + + (Val3)) == 8) \ __tgmres = Fct##l (Val1, Val2, Val3); \ else if (sizeof (Val1) == sizeof (double) \ || sizeof (Val2) == sizeof (double) \ || sizeof (Val3) == sizeof (double) \ - || __builtin_classify_type (Val) != 8) \ + || __builtin_classify_type ((Val1) + (Val2) \ + + (Val3)) != 8) \ __tgmres = Fct (Val1, Val2, Val3); \ else \ - __tgmres = Fct (Val1, Val2, Val3); \ + __tgmres = Fct##f (Val1, Val2, Val3); \ __tgmres; })) /* XXX This definition has to be changed as soon as the compiler understands @@ -136,8 +140,8 @@ __tgmres = Cfct##l (Val); \ } \ else if (sizeof (__real__ (Val)) == sizeof (double) \ - || (__builtin_classify_type (__real__ (Val)) \ - != 8) \ + || __builtin_classify_type (__real__ (Val)) \ + != 8) \ { \ if (sizeof (__real__ (Val)) == sizeof (Val)) \ __tgmres = Fct (Val); \ @@ -172,7 +176,9 @@ (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres; \ if ((sizeof (__real__ (Val1)) > sizeof (double) \ || sizeof (__real__ (Val2)) > sizeof (double)) \ - && __builtin_classify_type (__real__ (Val)) == 8) \ + && __builtin_classify_type (__real__ (Val1) \ + + __real__ (Val2)) \ + == 8) \ { \ if (sizeof (__real__ (Val1)) == sizeof (Val1) \ && sizeof (__real__ (Val2)) == sizeof (Val2)) \ @@ -182,8 +188,9 @@ } \ else if (sizeof (__real__ (Val1)) == sizeof (double) \ || sizeof (__real__ (Val2)) == sizeof(double) \ - || (__builtin_classify_type (__real__ (Val)) \ - != 8) \ + || __builtin_classify_type (__real__ (Val1) \ + + __real__ (Val2))\ + != 8) \ { \ if (sizeof (__real__ (Val1)) == sizeof (Val1) \ && sizeof (__real__ (Val2)) == sizeof (Val2)) \ @@ -388,7 +395,7 @@ /* Multiply-add function computed as a ternary operation. */ -#define fma(Vat1, Val2, Val3) \ +#define fma(Val1, Val2, Val3) \ __TGMATH_TERNARY_REAL_ONLY (Val1, Val2, Val3, fma) Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |