>>>>> Florian Weimer writes:

 > Isn't the following program supposed to be killed by SIGFPE?  It
The compiler is too smart ;-)
 > prints `inf', just as if the call to fesetenv() wasn't there. 

 > #include <fenv.h>

 > main()
 > {
 >   fesetenv (FE_NOMASK_ENV);
 >   printf("%g\n", 1.0 / 0.0);
 > }

Try the following program:

#define _GNU_SOURCE 1
#include <fenv.h>
#include <stdio.h>

int
main(void)
 {
   double one, zero;

   one = 1.0;
   zero = 0.0;
   fesetenv (FE_NOMASK_ENV);
   printf("%g\n", one / zero);
}

$ /opt/gcc-2.95/bin/gcc -Wall    fenv.c   -o fenv
$ ./fenv 
Floating point exception

-- 
 Andreas Jaeger
  SuSE Labs [EMAIL PROTECTED]
   private [EMAIL PROTECTED]

Reply via email to