lkml.org 
[lkml]   [1998]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: have a look at this proggie, please.
Date
Followup to:  <Pine.GSO.4.05.9811191517550.4315-100000@montezuma.acc.umu.se>
By author: David Weinehall <tao@acc.umu.se>
In newsgroup: linux.dev.kernel
> > Why the surprise? You've generated an exception #0, which Intel
> > called "divide by zero" in early IA processor manuals, but now call
> > "divide error". It is raised by any divide where the result overflows.
>
> 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?!
>

No. SIGFPE is the reported exception for integer division overflow or
division by zero. Illogical, perhaps, but that's the way it is.

-hpa
--
PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD 1E DF FE 69 EE 35 BD 74
See http://www.zytor.com/~hpa/ for web page and full PGP public key
I am Bahá'í -- ask me about it or see http://www.bahai.org/
"To love another person is to see the face of God." -- Les Misérables

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:45    [from the cache]
©2003-2011 Jasper Spaans