🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Does my concept of division by zero make any sense?

Started by
40 comments, last by RulerOfNothing 4 years, 2 months ago

I had written a blog post about why one can't divide by zero in programs, but since then, I've thought that maybe it can be done. Here is the outline, what do you guys think of this concept?

https://spotcpp.com/2020/04/08/division-by-zero-exploration/

It seems to make sense to me to some extent, however, I am unsure of to what extent or if it just makes no sense.

Basically, if this could be useful, when a divide by zero is encountered, it is stored and will have to be factored around and worked with as Q, and could potentially be processed until there is no longer a divide by zero problem.

Advertisement

What actual problem are you trying to solve?

Division by zero is permitted in certain problem domains, and in those areas the programmers can detect it and handle it appropriately.

In most of mathematics, however, the concept of dividing by zero is an invalid (and nonsensical) condition that indicates a logic error. Logic errors are also called bugs.

Also, there is the question of what do you get when you add a number to Q (since you appear to be treating Q as a number).

Overload the division operator and have at it.

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

I'm not trying to solve any particular problem, I'm just exploring this sort of imaginary Q concept

also, Q+X = Q there are a bunch of interesting properties for + and -, same as * and /.

Some programming languages do allow divide by zero, resulting in the positive or negative infinity value (generally floating point types). And those that throw an exception/error on divide by zero, still generally have some type that can be explicitly set to infinity.

Variables storing infinity behave generally as expected, with possible the exception of comparisons as it means `a == a + 1` for example is possible, should `a` be infinity. And the possibility to then get a NaN value (e.g. infinity + negative infinity).

Most code however doesn't expect or handle infinity values (or NaN, not a number values), so care is still needed.

The flaw in your reasoning is your assumption that for all x, x ≠ 0, x/0 == Q but 0/0 == 1. This leads to the conclusion 0 == 1, a contradiction, thus proving your assumption wrong. You're going to need a different set of assumptions, ones that are not provably incorrect, before there's any utility to this concept.

I'd suggest you study up on algebraic field extensions (the area of mathematics that addresses concepts like this). You claim to not be a mathematician, but I beg to differ.

Stephen M. Webb
Professional Free Software Developer

@Bregma x/0 = xQ, not just Q. (x/1)*(1/0) = xQ

Bregma said:

The flaw in your reasoning is your assumption that for all x, x ≠ 0, x/0 == Q but 0/0 == 1. This leads to the conclusion 0 == 1, a contradiction, thus proving your assumption wrong. You're going to need a different set of assumptions, ones that are not provably incorrect, before there's any utility to this concept.

I'd suggest you study up on algebraic field extensions (the area of mathematics that addresses concepts like this). You claim to not be a mathematician, but I beg to differ.

How do you get to 0 == 1? If you could go through it, please

h8CplusplusGuru said:

How do you get to 0 == 1? If you could go through it, please

From your article:

Once it is possible to divide by zero and turn a zero into a one

Stephen M. Webb
Professional Free Software Developer

This topic is closed to new replies.

Advertisement