tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

standards on SIGFPE for divide by zero

Correctly signalling SIGFPE for integer division by zero is important.

Integer division by zero is a bug.  Robust, safe programming language
environments such as Emacs and Java need to report such bugs without
crashing: there is nothing that it is OK for (/ x 0) to return in
elisp, and it's also not OK for Emacs to crash -- you should get a
debugger if you want, and continue with your editing unharmed, unless
the division happens deep inside some critical path of Emacs.  It may
be OK in elisp to check every integer division for a divisor of zero,
but that's not OK in fast systems, which rely on handling SIGFPE to
report the error.

Floating-point division by zero is a slightly fuzzier business --
there are values it is OK to yield, for instance -- so I sha'n't opine
on it here.

Home | Main Index | Thread Index | Old Index