lkml.org 
[lkml]   [1996]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectsignal(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


\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.186 / U:1.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site