You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.0 KiB

  1. --- a/stress-fp-error.c
  2. +++ b/stress-fp-error.c
  3. @@ -117,42 +117,43 @@ static int stress_fp_error(const stress_
  4. do {
  5. volatile double d1, d2;
  6. -#if defined(EDOM)
  7. +#if defined(EDOM) && defined(FE_INVALID)
  8. stress_fp_clear_error();
  9. stress_fp_check(args, "log(-1.0)", log(-1.0), NAN,
  10. true, false, EDOM, FE_INVALID);
  11. #endif
  12. -#if defined(ERANGE)
  13. +#if defined(ERANGE) && defined(FE_DIVBYZERO)
  14. stress_fp_clear_error();
  15. stress_fp_check(args, "log(0.0)", log(0.0), -HUGE_VAL,
  16. false, false, ERANGE, FE_DIVBYZERO);
  17. #endif
  18. -#if defined(EDOM)
  19. +#if defined(EDOM) && defined(FE_INVALID)
  20. stress_fp_clear_error();
  21. stress_fp_check(args, "log2(-1.0)", log2(-1.0), NAN,
  22. true, false, EDOM, FE_INVALID);
  23. #endif
  24. -#if defined(ERANGE)
  25. +#if defined(ERANGE) && defined(FE_DIVBYZERO)
  26. stress_fp_clear_error();
  27. stress_fp_check(args, "log2(0.0)", log2(0.0), -HUGE_VAL,
  28. false, false, ERANGE, FE_DIVBYZERO);
  29. #endif
  30. -#if defined(EDOM)
  31. +#if defined(EDOM) && defined(FE_INVALID)
  32. stress_fp_clear_error();
  33. stress_fp_check(args, "sqrt(-1.0)", sqrt(-1.0), NAN,
  34. true, false, EDOM, FE_INVALID);
  35. #endif
  36. -#if defined(EDOM)
  37. +#if defined(EDOM) && defined(FE_INVALID)
  38. stress_fp_clear_error();
  39. stress_fp_check(args, "sqrt(-1.0)", sqrt(-1.0), NAN,
  40. true, false, EDOM, FE_INVALID);
  41. #endif
  42. +#if defined(FE_INEXACT)
  43. /*
  44. * Use volatiles to force compiler to generate code
  45. * to perform run time computation of 1.0 / M_PI
  46. @@ -173,14 +174,15 @@ static int stress_fp_error(const stress_
  47. stress_fp_check(args, "DBL_MAX + DBL_MAX / 2.0",
  48. DBL_MAX + DBL_MAX / 2.0, INFINITY,
  49. false, true, 0, FE_OVERFLOW | FE_INEXACT);
  50. +#endif
  51. -#if defined(ERANGE)
  52. +#if defined(ERANGE) && defined(FE_UNDERFLOW)
  53. stress_fp_clear_error();
  54. stress_fp_check(args, "exp(-1000000.0)", exp(-1000000.0), 0.0,
  55. false, false, ERANGE, FE_UNDERFLOW);
  56. #endif
  57. -#if defined(ERANGE)
  58. +#if defined(ERANGE) && defined(FE_OVERFLOW)
  59. stress_fp_clear_error();
  60. stress_fp_check(args, "exp(DBL_MAX)", exp(DBL_MAX), HUGE_VAL,
  61. false, false, ERANGE, FE_OVERFLOW);