]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - math/test-tgmath.c
Fix the inaccuracy of j0f/j1f/y0f/y1f [BZ #14469, #14470, #14471, #14472]
[thirdparty/glibc.git] / math / test-tgmath.c
index 790d8bb4cde480a5b84510e403fec17102c9efdf..21af8c9502824f280032d883352c5e2d6d73f492 100644 (file)
@@ -1,5 +1,5 @@
 /* Test compilation of tgmath macros.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001-2021 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com> and
    Ulrich Drepper <drepper@redhat.com>, 2001.
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
 
 #ifndef HAVE_MAIN
-#undef __NO_MATH_INLINES
-#define __NO_MATH_INLINES 1
+#include <float.h>
 #include <math.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <tgmath.h>
 
 
 static void compile_test (void);
 static void compile_testf (void);
+#if LDBL_MANT_DIG > DBL_MANT_DIG
 static void compile_testl (void);
+#endif
 
 float fx;
 double dx;
 long double lx;
-
-int count_double;
-int count_float;
-int count_ldouble;
-
-#define NCALLS     115
+const float fy = 1.25;
+const double dy = 1.25;
+const long double ly = 1.25;
+complex float fz;
+complex double dz;
+complex long double lz;
+
+volatile int count_double;
+volatile int count_float;
+volatile int count_ldouble;
+volatile int count_cdouble;
+volatile int count_cfloat;
+volatile int count_cldouble;
+
+#define NCALLS     132
 #define NCALLS_INT 4
+#define NCCALLS    47
 
-int
-main (void)
+static int
+do_test (void)
 {
   int result = 0;
 
   count_float = count_double = count_ldouble = 0;
+  count_cfloat = count_cdouble = count_cldouble = 0;
   compile_test ();
-  if (count_float != 0)
+  if (count_float != 0 || count_cfloat != 0)
     {
       puts ("float function called for double test");
       result = 1;
     }
-  if (count_ldouble != 0)
+  if (count_ldouble != 0 || count_cldouble != 0)
     {
       puts ("long double function called for double test");
       result = 1;
@@ -72,15 +84,28 @@ main (void)
              count_double);
       result = 1;
     }
+  if (count_cdouble < NCCALLS)
+    {
+      printf ("double complex functions not called often enough (%d)\n",
+             count_cdouble);
+      result = 1;
+    }
+  else if (count_cdouble > NCCALLS)
+    {
+      printf ("double complex functions called too often (%d)\n",
+             count_cdouble);
+      result = 1;
+    }
 
   count_float = count_double = count_ldouble = 0;
+  count_cfloat = count_cdouble = count_cldouble = 0;
   compile_testf ();
-  if (count_double != 0)
+  if (count_double != 0 || count_cdouble != 0)
     {
       puts ("double function called for float test");
       result = 1;
     }
-  if (count_ldouble != 0)
+  if (count_ldouble != 0 || count_cldouble != 0)
     {
       puts ("long double function called for float test");
       result = 1;
@@ -96,16 +121,29 @@ main (void)
              count_double);
       result = 1;
     }
+  if (count_cfloat < NCCALLS)
+    {
+      printf ("float complex functions not called often enough (%d)\n",
+             count_cfloat);
+      result = 1;
+    }
+  else if (count_cfloat > NCCALLS)
+    {
+      printf ("float complex functions called too often (%d)\n",
+             count_cfloat);
+      result = 1;
+    }
 
-#ifndef NO_LONG_DOUBLE
+#if LDBL_MANT_DIG > DBL_MANT_DIG
   count_float = count_double = count_ldouble = 0;
+  count_cfloat = count_cdouble = count_cldouble = 0;
   compile_testl ();
-  if (count_float != 0)
+  if (count_float != 0 || count_cfloat != 0)
     {
       puts ("float function called for long double test");
       result = 1;
     }
-  if (count_double != 0)
+  if (count_double != 0 || count_cdouble != 0)
     {
       puts ("double function called for long double test");
       result = 1;
@@ -122,6 +160,18 @@ main (void)
              count_double);
       result = 1;
     }
+  if (count_cldouble < NCCALLS)
+    {
+      printf ("long double complex functions not called often enough (%d)\n",
+             count_cldouble);
+      result = 1;
+    }
+  else if (count_cldouble > NCCALLS)
+    {
+      printf ("long double complex functions called too often (%d)\n",
+             count_cldouble);
+      result = 1;
+    }
 #endif
 
   return result;
@@ -134,23 +184,35 @@ main (void)
 #define TYPE double
 #define TEST_INT 1
 #define x dx
+#define y dy
+#define z dz
 #define count count_double
+#define ccount count_cdouble
 #include "test-tgmath.c"
 
 #define F(name) name##f
 #define TYPE float
 #define x fx
+#define y fy
+#define z fz
 #define count count_float
+#define ccount count_cfloat
 #include "test-tgmath.c"
 
-#ifndef NO_LONG_DOUBLE
+#if LDBL_MANT_DIG > DBL_MANT_DIG
 #define F(name) name##l
 #define TYPE long double
 #define x lx
+#define y ly
+#define z lz
 #define count count_ldouble
+#define ccount count_cldouble
 #include "test-tgmath.c"
 #endif
 
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
 #else
 
 #ifdef DEBUG
@@ -162,10 +224,14 @@ main (void)
 static void
 F(compile_test) (void)
 {
-  TYPE a, b, c;
-  int i;
+  TYPE a, b, c = 1.0;
+  complex TYPE d;
+  int i = 2;
+  int saved_count;
   long int j;
   long long int k;
+  intmax_t m;
+  uintmax_t um;
 
   a = cos (cos (x));
   b = acos (acos (a));
@@ -200,24 +266,32 @@ F(compile_test) (void)
   b = fmod (fmod (a, b), fmod (c, x));
   a = nearbyint (nearbyint (x));
   b = round (round (a));
+  c = roundeven (roundeven (a));
   a = trunc (trunc (x));
   b = remquo (remquo (a, b, &i), remquo (c, x, &i), &i);
   j = lrint (x) + lround (a);
   k = llrint (b) + llround (c);
+  m = fromfp (a, FP_INT_UPWARD, 2) + fromfpx (b, FP_INT_DOWNWARD, 3);
+  um = ufromfp (c, FP_INT_TONEAREST, 4) + ufromfpx (a, FP_INT_TOWARDZERO, 5);
   a = erf (erf (x));
   b = erfc (erfc (a));
   a = tgamma (tgamma (x));
   b = lgamma (lgamma (a));
   a = rint (rint (x));
   b = nextafter (nextafter (a, b), nextafter (c, x));
-  a = nexttoward (nexttoward (x, a), c);
+  a = nextdown (nextdown (a));
+  b = nexttoward (nexttoward (x, a), c);
+  a = nextup (nextup (a));
   b = remainder (remainder (a, b), remainder (c, x));
   a = scalb (scalb (x, a), (TYPE) (6));
   k = scalbn (a, 7) + scalbln (c, 10l);
   i = ilogb (x);
+  j = llogb (x);
   a = fdim (fdim (x, a), fdim (c, b));
   b = fmax (fmax (a, x), fmax (c, b));
   a = fmin (fmin (x, a), fmin (c, b));
+  b = fmaxmag (fmaxmag (a, x), fmaxmag (c, b));
+  a = fminmag (fminmag (x, a), fminmag (c, b));
   b = fma (sin (a), sin (x), sin (c));
 
 #ifdef TEST_INT
@@ -226,14 +300,144 @@ F(compile_test) (void)
   c = fma (i, b, i);
   a = pow (i, c);
 #endif
+  x = a + b + c + i + j + k + m + um;
+
+  saved_count = count;
+  if (ccount != 0)
+    ccount = -10000;
+
+  d = cos (cos (z));
+  z = acos (acos (d));
+  d = sin (sin (z));
+  z = asin (asin (d));
+  d = tan (tan (z));
+  z = atan (atan (d));
+  d = cosh (cosh (z));
+  z = acosh (acosh (d));
+  d = sinh (sinh (z));
+  z = asinh (asinh (d));
+  d = tanh (tanh (z));
+  z = atanh (atanh (d));
+  d = exp (exp (z));
+  z = log (log (d));
+  d = sqrt (sqrt (z));
+  z = conj (conj (d));
+  d = fabs (conj (a));
+  z = pow (pow (a, d), pow (b, z));
+  d = cproj (cproj (z));
+  z += fabs (cproj (a));
+  a = carg (carg (z));
+  b = creal (creal (d));
+  c = cimag (cimag (z));
+  x += a + b + c + i + j + k;
+  z += d;
+
+  if (saved_count != count)
+    count = -10000;
+
+  if (0)
+    {
+      a = cos (y);
+      a = acos (y);
+      a = sin (y);
+      a = asin (y);
+      a = tan (y);
+      a = atan (y);
+      a = atan2 (y, y);
+      a = cosh (y);
+      a = acosh (y);
+      a = sinh (y);
+      a = asinh (y);
+      a = tanh (y);
+      a = atanh (y);
+      a = exp (y);
+      a = log (y);
+      a = log10 (y);
+      a = ldexp (y, 5);
+      a = frexp (y, &i);
+      a = expm1 (y);
+      a = log1p (y);
+      a = logb (y);
+      a = exp2 (y);
+      a = log2 (y);
+      a = pow (y, y);
+      a = sqrt (y);
+      a = hypot (y, y);
+      a = cbrt (y);
+      a = ceil (y);
+      a = fabs (y);
+      a = floor (y);
+      a = fmod (y, y);
+      a = nearbyint (y);
+      a = round (y);
+      a = roundeven (y);
+      a = trunc (y);
+      a = remquo (y, y, &i);
+      j = lrint (y) + lround (y);
+      k = llrint (y) + llround (y);
+      m = fromfp (y, FP_INT_UPWARD, 6) + fromfpx (y, FP_INT_DOWNWARD, 7);
+      um = (ufromfp (y, FP_INT_TONEAREST, 8)
+           + ufromfpx (y, FP_INT_TOWARDZERO, 9));
+      a = erf (y);
+      a = erfc (y);
+      a = tgamma (y);
+      a = lgamma (y);
+      a = rint (y);
+      a = nextafter (y, y);
+      a = nexttoward (y, y);
+      a = remainder (y, y);
+      a = scalb (y, (const TYPE) (6));
+      k = scalbn (y, 7) + scalbln (y, 10l);
+      i = ilogb (y);
+      j = llogb (y);
+      a = fdim (y, y);
+      a = fmax (y, y);
+      a = fmin (y, y);
+      a = fmaxmag (y, y);
+      a = fminmag (y, y);
+      a = fma (y, y, y);
+
+#ifdef TEST_INT
+      a = atan2 (i, y);
+      a = remquo (i, y, &i);
+      a = fma (i, y, i);
+      a = pow (i, y);
+#endif
+
+      d = cos ((const complex TYPE) z);
+      d = acos ((const complex TYPE) z);
+      d = sin ((const complex TYPE) z);
+      d = asin ((const complex TYPE) z);
+      d = tan ((const complex TYPE) z);
+      d = atan ((const complex TYPE) z);
+      d = cosh ((const complex TYPE) z);
+      d = acosh ((const complex TYPE) z);
+      d = sinh ((const complex TYPE) z);
+      d = asinh ((const complex TYPE) z);
+      d = tanh ((const complex TYPE) z);
+      d = atanh ((const complex TYPE) z);
+      d = exp ((const complex TYPE) z);
+      d = log ((const complex TYPE) z);
+      d = sqrt ((const complex TYPE) z);
+      d = pow ((const complex TYPE) z, (const complex TYPE) z);
+      d = fabs ((const complex TYPE) z);
+      d = carg ((const complex TYPE) z);
+      d = creal ((const complex TYPE) z);
+      d = cimag ((const complex TYPE) z);
+      d = conj ((const complex TYPE) z);
+      d = cproj ((const complex TYPE) z);
+    }
 }
 #undef x
+#undef y
+#undef z
 
 
 TYPE
 (F(cos)) (TYPE x)
 {
   ++count;
+  P ();
   return x;
 }
 
@@ -241,7 +445,7 @@ TYPE
 (F(acos)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -249,7 +453,7 @@ TYPE
 (F(sin)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -257,7 +461,7 @@ TYPE
 (F(asin)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -265,7 +469,7 @@ TYPE
 (F(tan)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -273,7 +477,7 @@ TYPE
 (F(atan)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -281,7 +485,7 @@ TYPE
 (F(atan2)) (TYPE x, TYPE y)
 {
   ++count;
-  P();
+  P ();
   return x + y;
 }
 
@@ -289,7 +493,7 @@ TYPE
 (F(cosh)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -297,7 +501,7 @@ TYPE
 (F(acosh)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -305,7 +509,7 @@ TYPE
 (F(sinh)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -313,7 +517,7 @@ TYPE
 (F(asinh)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -321,7 +525,7 @@ TYPE
 (F(tanh)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -329,7 +533,7 @@ TYPE
 (F(atanh)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -337,7 +541,7 @@ TYPE
 (F(exp)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -345,7 +549,7 @@ TYPE
 (F(log)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -353,7 +557,7 @@ TYPE
 (F(log10)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -361,23 +565,23 @@ TYPE
 (F(ldexp)) (TYPE x, int y)
 {
   ++count;
-  P();
-  return x;
+  P ();
+  return x + y;
 }
 
 TYPE
 (F(frexp)) (TYPE x, int *y)
 {
   ++count;
-  P();
-  return x;
+  P ();
+  return x + *y;
 }
 
 TYPE
 (F(expm1)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -385,7 +589,7 @@ TYPE
 (F(log1p)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -393,7 +597,7 @@ TYPE
 (F(logb)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -401,7 +605,7 @@ TYPE
 (F(exp2)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -409,7 +613,7 @@ TYPE
 (F(log2)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -417,7 +621,7 @@ TYPE
 (F(pow)) (TYPE x, TYPE y)
 {
   ++count;
-  P();
+  P ();
   return x + y;
 }
 
@@ -425,7 +629,7 @@ TYPE
 (F(sqrt)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -433,7 +637,7 @@ TYPE
 (F(hypot)) (TYPE x, TYPE y)
 {
   ++count;
-  P();
+  P ();
   return x + y;
 }
 
@@ -441,7 +645,7 @@ TYPE
 (F(cbrt)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -449,7 +653,7 @@ TYPE
 (F(ceil)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -457,7 +661,7 @@ TYPE
 (F(fabs)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -465,7 +669,7 @@ TYPE
 (F(floor)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -473,7 +677,7 @@ TYPE
 (F(fmod)) (TYPE x, TYPE y)
 {
   ++count;
-  P();
+  P ();
   return x + y;
 }
 
@@ -481,7 +685,7 @@ TYPE
 (F(nearbyint)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -489,7 +693,15 @@ TYPE
 (F(round)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
+  return x;
+}
+
+TYPE
+(F(roundeven)) (TYPE x)
+{
+  ++count;
+  P ();
   return x;
 }
 
@@ -497,7 +709,7 @@ TYPE
 (F(trunc)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -505,15 +717,15 @@ TYPE
 (F(remquo)) (TYPE x, TYPE y, int *i)
 {
   ++count;
-  P();
-  return x + y;
+  P ();
+  return x + y + *i;
 }
 
 long int
 (F(lrint)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -521,7 +733,7 @@ long int
 (F(lround)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -529,7 +741,7 @@ long long int
 (F(llrint)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -537,7 +749,39 @@ long long int
 (F(llround)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
+  return x;
+}
+
+intmax_t
+(F(fromfp)) (TYPE x, int round, unsigned int width)
+{
+  ++count;
+  P ();
+  return x;
+}
+
+intmax_t
+(F(fromfpx)) (TYPE x, int round, unsigned int width)
+{
+  ++count;
+  P ();
+  return x;
+}
+
+uintmax_t
+(F(ufromfp)) (TYPE x, int round, unsigned int width)
+{
+  ++count;
+  P ();
+  return x;
+}
+
+uintmax_t
+(F(ufromfpx)) (TYPE x, int round, unsigned int width)
+{
+  ++count;
+  P ();
   return x;
 }
 
@@ -545,7 +789,7 @@ TYPE
 (F(erf)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -553,7 +797,7 @@ TYPE
 (F(erfc)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -561,7 +805,7 @@ TYPE
 (F(tgamma)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -569,7 +813,7 @@ TYPE
 (F(lgamma)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -577,7 +821,7 @@ TYPE
 (F(rint)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
   return x;
 }
 
@@ -585,15 +829,31 @@ TYPE
 (F(nextafter)) (TYPE x, TYPE y)
 {
   ++count;
-  P();
+  P ();
   return x + y;
 }
 
+TYPE
+(F(nextdown)) (TYPE x)
+{
+  ++count;
+  P ();
+  return x;
+}
+
 TYPE
 (F(nexttoward)) (TYPE x, long double y)
 {
   ++count;
-  P();
+  P ();
+  return x + y;
+}
+
+TYPE
+(F(nextup)) (TYPE x)
+{
+  ++count;
+  P ();
   return x;
 }
 
@@ -601,7 +861,7 @@ TYPE
 (F(remainder)) (TYPE x, TYPE y)
 {
   ++count;
-  P();
+  P ();
   return x + y;
 }
 
@@ -609,7 +869,7 @@ TYPE
 (F(scalb)) (TYPE x, TYPE y)
 {
   ++count;
-  P();
+  P ();
   return x + y;
 }
 
@@ -617,23 +877,31 @@ TYPE
 (F(scalbn)) (TYPE x, int y)
 {
   ++count;
-  P();
-  return x;
+  P ();
+  return x + y;
 }
 
 TYPE
 (F(scalbln)) (TYPE x, long int y)
 {
   ++count;
-  P();
-  return x;
+  P ();
+  return x + y;
 }
 
 int
 (F(ilogb)) (TYPE x)
 {
   ++count;
-  P();
+  P ();
+  return x;
+}
+
+long int
+(F(llogb)) (TYPE x)
+{
+  ++count;
+  P ();
   return x;
 }
 
@@ -641,7 +909,7 @@ TYPE
 (F(fdim)) (TYPE x, TYPE y)
 {
   ++count;
-  P();
+  P ();
   return x + y;
 }
 
@@ -649,7 +917,7 @@ TYPE
 (F(fmin)) (TYPE x, TYPE y)
 {
   ++count;
-  P();
+  P ();
   return x + y;
 }
 
@@ -657,7 +925,23 @@ TYPE
 (F(fmax)) (TYPE x, TYPE y)
 {
   ++count;
-  P();
+  P ();
+  return x + y;
+}
+
+TYPE
+(F(fminmag)) (TYPE x, TYPE y)
+{
+  ++count;
+  P ();
+  return x + y;
+}
+
+TYPE
+(F(fmaxmag)) (TYPE x, TYPE y)
+{
+  ++count;
+  P ();
   return x + y;
 }
 
@@ -665,12 +949,189 @@ TYPE
 (F(fma)) (TYPE x, TYPE y, TYPE z)
 {
   ++count;
-  P();
+  P ();
   return x + y + z;
 }
 
+complex TYPE
+(F(cacos)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(casin)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(catan)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(ccos)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(csin)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(ctan)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(cacosh)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(casinh)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(catanh)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(ccosh)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(csinh)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(ctanh)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(cexp)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(clog)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(csqrt)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(cpow)) (complex TYPE x, complex TYPE y)
+{
+  ++ccount;
+  P ();
+  return x + y;
+}
+
+TYPE
+(F(cabs)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+TYPE
+(F(carg)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+TYPE
+(F(creal)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return __real__ x;
+}
+
+TYPE
+(F(cimag)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return __imag__ x;
+}
+
+complex TYPE
+(F(conj)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
+complex TYPE
+(F(cproj)) (complex TYPE x)
+{
+  ++ccount;
+  P ();
+  return x;
+}
+
 #undef F
 #undef TYPE
 #undef count
+#undef ccount
 #undef TEST_INT
 #endif