Messages in this thread | | | Date | Tue, 23 Apr 1996 17:03:15 +0200 (MET DST) | From | Andreas Kostyrka <> | Subject | signal(SIGFPE,SIG_IGN), possible solution? |
| |
Hi!
I was just thinking, and the following solution occured to me, so I just want to know if this is possible:
1) When SIGFPE is been ignored, we want x/0 to return some constant value, let's say 0, and continue with the next statement. 2) The important thing is, if SIGFPE is signalled by the FPU a bit more exact, so we can be sure, that we got SIGFPE because of x/0 or other causes. 3) The FPU has a stack architecture, that much I know about Intel FPU's :) 4) Now we could just pop two arguments from the stack, and because we probably know that it will execute the fdiv instruction again, we push say 0.0 100.0 on the stack and reexecute the fdiv. It should now return a 0.0/100.0==0.0 and all is well.
It sounds bit weird, but if the error condition of the FPU is precise enough, one could handle this one :)
Linus, what do you thing?
Andreas
| |