File: bug-tgmath1.c

package info (click to toggle)
glibc 2.19-13
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 202,472 kB
  • ctags: 140,344
  • sloc: ansic: 969,274; asm: 241,208; sh: 10,047; makefile: 8,467; cpp: 3,595; perl: 2,077; pascal: 1,839; awk: 1,704; yacc: 317; sed: 73
file content (47 lines) | stat: -rw-r--r-- 1,411 bytes parent folder | download | duplicates (25)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <stdio.h>
#include <tgmath.h>


int
main (void)
{
  int retval = 0;

#define TEST(expr, res) \
  if (sizeof (expr) != res)						      \
    {									      \
      printf ("sizeof(%s) == %zu, expected %zu\n", #expr,		      \
	      sizeof (expr), (size_t) (res));				      \
      retval = 1;								      \
    }

  TEST (creal (1.0), sizeof (double));
  TEST (creal (1.0 + 1.0i), sizeof (double));
  TEST (creal (1.0l), sizeof (long double));
  TEST (creal (1.0l + 1.0li), sizeof (long double));
  TEST (creal (1.0f), sizeof (float));
  TEST (creal (1.0f + 1.0fi), sizeof (float));

  TEST (cimag (1.0), sizeof (double));
  TEST (cimag (1.0 + 1.0i), sizeof (double));
  TEST (cimag (1.0l), sizeof (long double));
  TEST (cimag (1.0l + 1.0li), sizeof (long double));
  TEST (cimag (1.0f), sizeof (float));
  TEST (cimag (1.0f + 1.0fi), sizeof (float));

  TEST (fabs (1.0), sizeof (double));
  TEST (fabs (1.0 + 1.0i), sizeof (double));
  TEST (fabs (1.0l), sizeof (long double));
  TEST (fabs (1.0l + 1.0li), sizeof (long double));
  TEST (fabs (1.0f), sizeof (float));
  TEST (fabs (1.0f + 1.0fi), sizeof (float));

  TEST (carg (1.0), sizeof (double));
  TEST (carg (1.0 + 1.0i), sizeof (double));
  TEST (carg (1.0l), sizeof (long double));
  TEST (carg (1.0l + 1.0li), sizeof (long double));
  TEST (carg (1.0f), sizeof (float));
  TEST (carg (1.0f + 1.0fi), sizeof (float));

  return retval;
}