Why does a division by zero produce an error or undefined message?

Click For Summary

Discussion Overview

The discussion revolves around the concept of division by zero, exploring its mathematical implications and how different systems, particularly computers and calculators, handle such operations. Participants examine both the theoretical aspects of why division by zero is considered undefined and the practical consequences in programming and computational environments.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants assert that division by zero is undefined, as no real number multiplied by zero can yield a non-zero result.
  • Others discuss how different calculators and operating systems handle division by zero, with some displaying error messages while others may show positive or negative infinity.
  • A participant mentions that in programming, particularly in C++, dividing by zero typically results in an exception being thrown, while others argue that following the IEEE 754 standard allows for representation of infinity.
  • There is a discussion about the implications of division by zero in both mathematical and computational contexts, with some suggesting that the question may pertain to the handling of errors in software versus the mathematical definition itself.
  • Some participants express confusion about the original intent of the question, whether it is focused on computational behavior or the mathematical reasoning behind division by zero being undefined.

Areas of Agreement / Disagreement

Participants do not reach a consensus on whether the discussion should focus on the computational handling of division by zero or its mathematical definition. Multiple competing views on the implications of division by zero and how it is treated in different contexts remain present throughout the discussion.

Contextual Notes

There are unresolved questions regarding the definitions and implications of division by zero in both mathematics and computer science. The discussion highlights the differences in handling division by zero across various programming languages and systems, as well as the philosophical considerations of what it means for a mathematical operation to be defined.

  • #31
If the divisor is small enough compared to the dividend that the quotient has gotten too big for its register, an "Overflow" (or maybe "Size Error" which covers a few more bases) return-code gets tossed back to the program, instead of the usual "yup, worked fine".

If you've gotten a literal "Divide by Zero" error, that's probably extra code in the software, inserted by a "helpful" compiler/interpreter. The hardware doesn't actually care, and will continue onwards unless you've coded in something to do if an error occurs.
 
Last edited:
Technology news on Phys.org
  • #32
Lots of machine operations produce return-codes that get sent back to the program running on them whether something unusal happened or not. It's up to the programmer to choose to use them.

In the case of a Size-Error for a divide, it doesn't have to be a zero, just any number small enough (compared to the dividend) that the quotient overflows its register.

If you get a literal "Divide By Zero", that's probably some code introduced by the "helpful" compiler/interpreter, as a pre-check.

Doesn't hurt the machine ; it will just keep chugging along either way.
 
  • #33
I just looked it up. IEEE 754, which is the standard most chips use for floating point returns +INF for a/+0 and -a/-0 (where a is a positive number) and -INF for a/-0 and -a/+0. It also have two zeros, +0 amd -0. Dividing either zero by either zero gives NaN.

How the program treats this is, of course, up to the programmer.
 
  • Informative
Likes   Reactions: hmmm27

Similar threads

  • · Replies 47 ·
2
Replies
47
Views
6K
  • · Replies 28 ·
Replies
28
Views
5K
  • · Replies 8 ·
Replies
8
Views
4K
Replies
29
Views
5K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 8 ·
Replies
8
Views
13K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K