Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.target / s390 / tf_to_di-1.c
blobd79e6f3502e2f0fc2d0bf00c15eed21114a143f6
1 /* { dg-options "-O0 -mlong-double-128" } */
3 #include <stdio.h>
4 #include <stdlib.h>
6 void
7 check_ll (long double ld, long long ll)
9 if ((long long)ld != ll)
11 printf ("ld: %Lf expect: %lld result: %lld\n",
12 ld, ll, (long long)ld);
13 abort ();
17 void
18 check_ull (long double ld, unsigned long long ull)
20 if ((unsigned long long)ld != ull)
22 printf ("ld: %Lf expect: %llu result: %llu\n",
23 ld, ull, (unsigned long long)ld);
24 abort ();
28 int
29 main ()
31 const long long ll_max = (long long)((1ULL << 63) - 1);
32 const long long ll_min = -ll_max - 1;
34 check_ll (206.23253, 206LL);
35 check_ull (206.23253, 206ULL);
36 check_ll ((long double)ll_max, ll_max);
37 check_ull ((long double)ll_max, ll_max);
38 check_ll ((long double)ll_min, ll_min);
39 check_ll (0.0, 0);
40 check_ull (0.0, 0);
41 check_ll (-1.0, -1);
42 check_ll ((long double)0xffffffffffffffffULL, ll_max);
43 check_ull ((long double)0xffffffffffffffffULL, 0xffffffffffffffffULL);
45 return 0;