#include #include int main () { union U { double f; unsigned long long int i; } u; for (int i = 0; i < 10000000; i++) { u.i = ((unsigned long long) random () << 40) ^ ((unsigned long long) random () << 20) ^ random (); double c = u.f; if (!isnormal (c) || c < 0) continue; double c2 = c * c; for (int j = -15; j <= 15; j++) { double x = c2; if (j < 0) { for (int k = j; k != 0; k++) x = nexttoward (x, -1.0f); } else if (j > 0) { for (int k = j; k != 0; k--) x = nexttoward (x, __builtin_inf ()); } if (x < 0) continue; if (isinf (c2)) continue; double c3 = __builtin_sqrt (c2); double c4 = c2, c5 = c2; #ifdef FIXME double c4 = nexttoward (c2, 0.0); double c4s = __builtin_sqrt (c4); if (c3 >= c && c4s == c) ; else c4 = c2; double c5 = nexttoward (c2, __builtin_inf ()); double c5s = __builtin_sqrt (c5); if (c3 <= c && !isinf (c5) && c5s == c) ; else c5 = c2; if (c3 < c && (__builtin_sqrt (x) < c) == (x <= c2) && (__builtin_sqrt (x) >= c) == (x > c2)) ; else #endif if ((__builtin_sqrt (x) < c) != (x < c4)) { if ((__builtin_sqrt (x) >= c) != (x >= c4)) __builtin_printf ("= c %.12a c4 %.12a x %.12a %d\n", c, c4, x, j); else __builtin_printf ("< c %.12a c4 %.12a x %.12a %d\n", c, c4, x, j); } else if ((__builtin_sqrt (x) >= c) != (x >= c4)) __builtin_printf (">= c %.12a c4 %.12a x %.12a %d\n", c, c4, x, j); #ifdef FIXME if (c3 > c && (__builtin_sqrt (x) <= c) == (x < c2) && (__builtin_sqrt (x) > c) == (x >= c2)) ; else #endif if ((__builtin_sqrt (x) <= c) != (x <= c5)) { if ((__builtin_sqrt (x) > c) != (x > c5)) __builtin_printf ("<=/> c %.12a c5 %.12a x %.12a %d\n", c, c5, x, j); else __builtin_printf ("<= c %.12a c5 %.12a x %.12a %d\n", c, c5, x, j); } else if ((__builtin_sqrt (x) > c) != (x > c5)) __builtin_printf ("> c %.12a c5 %.12a x %.12a %d\n", c, c5, x, j); } } return 0; }