To: BILLM AT vaxc DOT cc DOT monash DOT edu DOT au, DJGPP AT SUN DOT SOE DOT CLARKSON DOT EDU From: A DOT APPLEYARD AT fs1 DOT mt DOT umist DOT ac DOT uk Date: 10 Nov 93 14:59:53 GMT Subject: Re: Not trapping overflow etc in Gnu C As in my previous messages, I want to run a Gnu C (or C++) program in a mode where "infinity and NaN (overflow, divide by zero) do not cause an error, but the program continues". I can write my own code to find if a value is infinity or NaN before I print it. I tried to do it by resetting the CW, as in the short test programs hereinunder (dividing by zero in line 'z=y/x') hereinunder, but I always got the same fault remark:- variorum listfile on Wed Nov 10 14:39:51 1993 of the 4 programs:- file 1 = t$.cc, 9 lines file 2 = t$$.cc, 10 lines file 3 = t$$$.cc, 10 lines file 4 = t$$$$.cc, 10 lines [F 1][F 2][F 3][F 4] 1 1 1 1 #include 2 2 2 2 short i; double x=1,y=0,z; 3 3 3 3 main(){ 4 4 4 4 asm("fstcw _i"); 5 5 5 5 printf("%8x\n",i); 6 i&=0xffc0; 6 i|=3; 6 i&=0xffc0; i|=3; 6 7 7 7 asm("fldcw _i"); 7 8 8 8 printf("%8x\n",i); fflush(stdout); 8 9 9 9 z=x/y; 9 10 10 10 } variorum listfile on Wed Nov 10 14:42:34 1993 of their screen outputs:- file 1 = t$.res, 25 lines file 2 = t$$.res, 25 lines file 3 = t$$$.res, 25 lines file 4 = t$$$$.res, 25 lines [F 1][F 2][F 3][F 4] 1 1 1 1 ! 2 C:\WORK>t$$$$ 2 C:\WORK>t$$$ 2 C:\WORK>t$$ 2 C:\WORK>t$ 3 3 3 3 37a 4 340 4 37b 4 343 4 37a 5 5 Exception 117 at eip=10d6 5 Exception 117 at eip=10dd 5 Exception 117 at eip=10cf 6 6 6 6 7 7 7 7 C:\WORK>call \am\readscr Line 1 was the top line of the screen when the screen dumps were made. Lines 8 to end were empty. The '!' in line 1 appeared there as the program was running. Why!? Line 2 is where I called the compiled forms of the programs. Before calling each of these compiled forms, I called CLS (clear screen). My maths coprocessor manual says that 'exception 117' is an exception defined by an application. Line 7 is where I call a program that I wrote to copy the screen to a file. P.S. How to suppress interrupt at divide by zero in int arithmetic?