Back to index

glibc  2.9
bug-tgmath1.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <tgmath.h>
00003 
00004 
00005 int
00006 main (void)
00007 {
00008   int retval = 0;
00009 
00010 #define TEST(expr, res) \
00011   if (sizeof (expr) != res)                                          \
00012     {                                                                \
00013       printf ("sizeof(%s) == %zu, expected %zu\n", #expr,                   \
00014              sizeof (expr), (size_t) (res));                                \
00015       retval = 1;                                                           \
00016     }
00017 
00018   TEST (creal (1.0), sizeof (double));
00019   TEST (creal (1.0 + 1.0i), sizeof (double));
00020   TEST (creal (1.0l), sizeof (long double));
00021   TEST (creal (1.0l + 1.0li), sizeof (long double));
00022   TEST (creal (1.0f), sizeof (float));
00023   TEST (creal (1.0f + 1.0fi), sizeof (float));
00024 
00025   TEST (cimag (1.0), sizeof (double));
00026   TEST (cimag (1.0 + 1.0i), sizeof (double));
00027   TEST (cimag (1.0l), sizeof (long double));
00028   TEST (cimag (1.0l + 1.0li), sizeof (long double));
00029   TEST (cimag (1.0f), sizeof (float));
00030   TEST (cimag (1.0f + 1.0fi), sizeof (float));
00031 
00032   TEST (fabs (1.0), sizeof (double));
00033   TEST (fabs (1.0 + 1.0i), sizeof (double));
00034   TEST (fabs (1.0l), sizeof (long double));
00035   TEST (fabs (1.0l + 1.0li), sizeof (long double));
00036   TEST (fabs (1.0f), sizeof (float));
00037   TEST (fabs (1.0f + 1.0fi), sizeof (float));
00038 
00039   TEST (carg (1.0), sizeof (double));
00040   TEST (carg (1.0 + 1.0i), sizeof (double));
00041   TEST (carg (1.0l), sizeof (long double));
00042   TEST (carg (1.0l + 1.0li), sizeof (long double));
00043   TEST (carg (1.0f), sizeof (float));
00044   TEST (carg (1.0f + 1.0fi), sizeof (float));
00045 
00046   return retval;
00047 }