Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site othervax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!linus!philabs!micomvax!othervax!scott From: scott@othervax.UUCP (Scott Pace) Newsgroups: net.lang.c Subject: problem trapping floating point overflows Message-ID: <686@othervax.UUCP> Date: Thu, 22-Aug-85 11:05:07 EDT Article-I.D.: othervax.686 Posted: Thu Aug 22 11:05:07 1985 Date-Received: Sun, 25-Aug-85 00:20:15 EDT References: <2176@hcradm.UUCP> Reply-To: scott@othervax.UUCP (Scott Pace) Organization: Philips Information Systems - St. Laurent P.Q., Canada Lines: 40 Summary: If I compile and run the following program, it will continue until a floating point overflow occurs and will then go and proccess the interrupt routine. However, it seems that the return from the interrupt routine is returning to the start of the instruction which caused the overflow in the first place. Therefore, the program just goes into an infinite loop printing the overflow message. What exactly is happening here or what am I doing wrong ? Any help greatly appreciated. By the way, this is on a VAX11/780 running 4.1BSD #includeint fpe_flag = 0; main() { double a = 1.0,b = 2.0; int fltover(); sigset(SIGFPE,fltover); for (;;) { a *= b; if (fpe_flag) exit(1); } } fltover() { printf("Floating point overflow\n"); fpe_flag = 1; } Cheers, Scott Pace, Philips Info. Sys. Ltd., Montreal. ...!philabs!micomvax!othervax!scott