A thread on webmaster world poses a question I had several months ago but never found a clear answer for.
The question is simple, but the answer is more complicated.
What is 1 divided by 0?
According to Google’s calculator, it’s 0, but I think they’re right out. The two answers I had found were infinity and undefined (or error).
As an experiment, I decided to try it on all the calculators I could get my hands on:
The unix desk calculator (dc): divide by zero
Gnome’s calculator (gnome-calculator): inf
KDE’s calculator (kcalc): error
My HP 48G: Error: infinite result
My palm pilot: error
So that’s 3 votes for error and 2 for infinity.
Next, I tried various programming languages:
Perl: Illegal division by zero
PHP: Division by zero
Bash shell: division by zero
C/C++: division by zero
Java: / by zero
Python: ZeroDivisionError: integer division or modulo by zero
With all 6 being errors, it looks like programmers have decided you’re not allowed to do it.
That makes a total of 9 votes for undefined (or error) and 2 votes for infinity, so undefined is the big winner.
If you’re still not satisfied, you can find more on the subject by searching Google for divide by zero.