| 1 |
/* { dg-options "-O0 -mlong-double-128" } */ |
| 2 |
|
| 3 |
#include <stdio.h> |
| 4 |
#include <stdlib.h> |
| 5 |
|
| 6 |
void |
| 7 |
check_ll (long double ld, long long ll) |
| 8 |
{ |
| 9 |
if ((long long)ld != ll) |
| 10 |
{ |
| 11 |
printf ("ld: %Lf expect: %lld result: %lld\n", |
| 12 |
ld, ll, (long long)ld); |
| 13 |
abort (); |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
void |
| 18 |
check_ull (long double ld, unsigned long long ull) |
| 19 |
{ |
| 20 |
if ((unsigned long long)ld != ull) |
| 21 |
{ |
| 22 |
printf ("ld: %Lf expect: %llu result: %llu\n", |
| 23 |
ld, ull, (unsigned long long)ld); |
| 24 |
abort (); |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
int |
| 29 |
main () |
| 30 |
{ |
| 31 |
const long long ll_max = (long long)((1ULL << 63) - 1); |
| 32 |
const long long ll_min = -ll_max - 1; |
| 33 |
|
| 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); |
| 44 |
|
| 45 |
return 0; |
| 46 |
} |