fork download
  1. #include <stdio.h>
  2. #include <fenv.h>
  3.  
  4. #ifndef FE_INEXACT
  5. # error No FP Exception handling!
  6. #endif
  7.  
  8. int main()
  9. {
  10. double a = 4.0;
  11. a /= 3.0;
  12.  
  13. if (fetestexcept(FE_INEXACT) & FE_INEXACT)
  14. {
  15. printf("Exception occurred\n");
  16. }
  17. else
  18. {
  19. printf("No exception.\n");
  20. }
  21. }
  22.  
Success #stdin #stdout 0s 1788KB
stdin
Standard input is empty
stdout
Exception occurred