fork download
  1. #include <stdio.h>
  2. #include <stdint.h>
  3. #include <stdbool.h>
  4.  
  5.  
  6. union foo
  7. {
  8. int32_t i;
  9. float f;
  10. };
  11.  
  12.  
  13. void compare (const union foo * lo,
  14. const union foo * hi)
  15. {
  16. bool success = (lo->f) < (hi->f);
  17. if (!success)
  18. printf ("lo:%x:%f hi:%x:%f\n", lo->i, lo->f, hi->i, hi->f);
  19. }
  20.  
  21.  
  22. bool is_special_case (int32_t value)
  23. {
  24. static const int32_t special = (int32_t)0xFF << 23;
  25. return (value & special) == special;
  26. }
  27.  
  28.  
  29. int main(void)
  30. {
  31.  
  32. for (int32_t i = 0; i < INT32_MAX - 1; ++i)
  33. {
  34. bool special = is_special_case (i);
  35. if (special)
  36. continue;
  37.  
  38. union foo lo = {.i = i};
  39. union foo hi = {.i = i + 1};
  40.  
  41. compare (&lo, &hi);
  42. }
  43.  
  44. }
  45.  
Success #stdin #stdout 1.92s 9296KB
stdin
Standard input is empty
stdout
Standard output is empty