| 1 |
/* { dg-do run } */ |
| 2 |
|
| 3 |
#include <stdio.h> |
| 4 |
#include <stdlib.h> |
| 5 |
#include <stdint.h> |
| 6 |
|
| 7 |
double num = 100; |
| 8 |
double denom = 50; |
| 9 |
|
| 10 |
union bits { |
| 11 |
double fp; |
| 12 |
uint64_t ull; |
| 13 |
}; |
| 14 |
|
| 15 |
int main (int argc, char* argv[]) |
| 16 |
{ |
| 17 |
union bits recip; |
| 18 |
union bits res; |
| 19 |
|
| 20 |
recip.fp = 1.0 / denom; |
| 21 |
|
| 22 |
if (recip.ull != 0x3f947ae147ae147b) |
| 23 |
{ |
| 24 |
fprintf (stderr, "incorrectly-rounded reciprocal: %llx", recip.ull); |
| 25 |
exit (1); |
| 26 |
} |
| 27 |
|
| 28 |
res.fp = num / denom; |
| 29 |
|
| 30 |
if (res.ull != 0x4000000000000000) |
| 31 |
{ |
| 32 |
fprintf (stderr, "incorrectly-rounded quotient: %llx", res.ull); |
| 33 |
exit (1); |
| 34 |
} |
| 35 |
|
| 36 |
return 0; |
| 37 |
} |