[lkml]   [1998]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: have a look at this proggie, please.
David Weinehall wrote:
> That's NOT an divide by zero...
> Output:
> -2147483648 * -1 = -2147483648
> Floating exception
> ^^^^^^^^^^^^^^^^^^
> Quite obviously, -MAXINT-1 * -1 is too large for an integer to hold (by
> one), but it should *NOT* report a floating exception... Right?!

Not sure if this is Intelish behavior or POSIX, but divide by zero and
overflow are treated as SIGFPE's (FPE_INTOVFLOW and FPE_INTDIV0)

I just looked at this a bit back under borland (I do a lot of my work
with Borland still -- still working on convincing management to at least
try out linux). It looked like though it was the way the processor
reports them (from my 386/486 processor book -- can't check right now,
book got borrowed). (I had to patch Borland's RTL to allow me to step
over the offending instruction so I could ignore the behavior -- kind of
fun manually decoding DIV and IDIV in C code :)

So assuming that they are looped under FPE, then the behavior is
correct. the main signal is the SIGFPE, the sub action is FPE_INTOVLOW.

Steven Roberts

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:45    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean