Live data from Hacker News

1/0 = 0

hillelwayne.com

301–310 of 593 posts

Re: 1/0 = 0

#301

Earlier quoted context omitted.

> correctly state the undefined nature of 1/0 Erm, when we say it's "undefined" we mean it literally -- standard mathematical systems of arithmetic do not define a value for that division. If you make another system of arithmetic you can define it how you want and be consistent with "regular maths" for the operations in which things are defined. It's an extension. > We have "NaN" for a reason Funnily enough, IEEE754…

Standard mathematical systems of arithmetic do not permit a reasonable definition of 1/0. Mathematicians define equality of fractions by stating that a/b = c/d if and only if a·d = b·c. This means that if we define 1/0 = 1 then 0 = 1. To be fair, this is perfectly consistent, except everything in our system is equal to zero.

The story of what happens if we defined, for example, 1/0 = 0 is a little more complicated. I will include it because it is sufficiently interesting.

Equality of fractions is defined differently when zero divisors are allowed in the denominator. A zero divisor is a non-zero number that can multiply with another non-zero number to get zero. For example, if we work mod 12 then 3 is a zero divisor because 3·4 = 0.

If we want to allow zero or zero divisors in our denominators then we say that a/b = c/d if and only if there is some value s such that s·(a·d - b·c) = 0 where s is anything allowable in the denominator. If we are working with the integers, including this s term does nothing because s has to be something that can be a denominator and we only allow non-zero denominators.

So, even if we define 1/0 = 0 then literally every fraction would be equal to every other fraction.

These conventions can be broken (like, for example, addition of floating point numbers is not associative as pointed out by other comments) but it is definitely not "natural". In other fields of mathematics, like measure theory, it is possible to define things like "zero times infinity is zero" which is traditionally undefined but is a convenient shortcut and does not break anything that people working in measure theory care about.

For more: https://en.wikipedia.org/wiki/Localization_of_a_ring#For_gen...

Re: 1/0 = 0

#302
I’m not sure if a general system should deviate from established definitions but in specific programs I certainly bend the rules.

For instance, I made a game, and I might accidentally end up with a value that won’t modulus correctly due to zero denominator. In that app, mathematical accuracy for this single outlier does me no good at all because it manifests as “might crash randomly” when I want “doesn’t crash, period”. I therefore wrote a “safe modulus” routine that essentially guards against zero and makes a command decision to return a value. The added robustness against crashes is preferable, since I may not know if I have found every stupid case of the math accidentally working out to exactly zero.

In fact, more generally, exact zeroes mask lots of bugs. They are often default initial values, meaning you might not notice something working accidentally. Sometimes I use a really tiny float as my “meant to be zero” to distinguish, e.g. 0.0001 means “item was supposed to appear at coordinate 0”, that way anything that accidentally ended up at 0 is easier to detect.

Re: 1/0 = 0

#304

Earlier quoted context omitted.

Practically, it's quite common to not immediately know the divisor. In cases where the divisor is initially unknown but takes an imperceptible amount of time to compute it's better to render 0%. Otherwise you might get a flash of a full progress bar (for example) while the divisor is determined. Of course, it's context dependent. As others mention, your code might be full of stuff like X / (divisor || 1) .

X / (divisor || 1). It's invalid code in C, C++ and Java.

Boolean operators returning values is common, especially in dynamically typed languages. The code is valid in JavaScript, for example, and in Python (except it uses "or" instead of "||").

Re: 1/0 = 0

#305
post #5

My two issue with this is it totally relies on a specially constructed definition, and it leads to unintuitive results. The issue with special definitions is you can use them to say anything you want, turning regular, common operations into weirdness. What does it mean to take a factorial on the real numbers, or to add only on the even integers? In both cases, we're twisting what are generally accepted mechanics and…

You may not be familiar but a "factorial on the real numbers" is the gamma function and it has all sorts of useful applications. (it works on real and complex numbers except for non-positive integers)

The concerned reader might wonder how it is possible to assert that there is _one_ correct definition of an extension of the factorial function to the real/complex numbers. Why is the gamma function better than any other extension?

The answer is that the gamma function is the unique logarithmically convex extension of the factorial function.

Re: 1/0 = 0

#306
1/0 = 0 is just plain lazy. So is 0^0 = 1. Now some might argue it is a matter of how you define the operators. What I say is that then separate them cleanly. e.g. pow(0,0) = 1 powr(0,0) = NaN

Re: 1/0 = 0

#307

"Mathematics does not give us truths, it gives us consequences." I'd like to point out that, as I stated in another comment in this thread, the author's supposed refutation of the inconsistency inherent in division by zero within fields is incorrect. Their refutation is as follows: The problem is in step (3): our division theorem is only valid for c ≠ 0, so you can’t go from 1/0 0 to 1 * 0/0. The “denominator is nonz…

First, mathematics does not give us true statements about the world, it gives us consequences that must follow if we accept various axioms or definitions. Isn't a consequence in itself a true statement?

Allow me to clarify that point. The idea is that - conceptually speaking - mathematics cannot be used to tell you empirical axioms about the world in which we reside. All it can do is tell you what must be true given certain well-defined assumptions. It is a phenomenally powerful tool for proving things about the world from empirical axioms, but which empirical axioms we choose to rely on in engineering is mostly the domain of physics or the sciences.

The underlying point here is mostly a philosophical one, but it has some bearing on the matter at hand. In effect, the definition (or lack thereof) for division by zero in fields is of no practical consequence for the real world impact of implementing an operation which admits division by zero. I can define an algebraic structure in which division by zero is sane (it is not in fields, despite what the article states!), or I can define an algebraic structure in which division by zero is insane. Both can be coherent, consistent and genuinely useful.

But whether or not I can define something that works has nothing to do with what happens "when the rubber meets the road", so to speak. It was a mistake to open up an argument about programming division by 0 using the field axioms in the first place. There is no "one truth", there are only facts which must follow as consequences from assumptions. This is especially the case for programming, considering that computers are fundamentally incapable of working with real numbers in the first place.

Re: 1/0 = 0

#308

Earlier quoted context omitted.

1/0 is not infinity either...

If we assume that we got to 0 because of a rounding error we do know that it should be some positive integer. I think that 1/0 = infinity is a reasonable substitute for an actual value. 1/0 = 0 seems absurd. 1/(a number approaching 0) produces ever increasing integers. I don't know, does it even matter? What happens when you try to divide a physical object into 0 parts? It doesn't create infinite pieces. It doesn't m…

If you divide something 12 feet long into 3 parts, you don't get 4 parts, you get 3 parts that are each 4 feet long. So, if dividing a number by 0 yields infinity, you would expect that dividing something physical into 0 parts would yield 0 parts, each of infinite size, whatever that means.

Sorry to be pedantic.

Re: 1/0 = 0

#310

> We’ve now established that if we choose some constant C, then defining division such that x/0 = C does not lead to any inconsistencies. No, you haven't. You've merely failed to locate any. You've said "I'm not going to prove that this works. I'm going to assume that it does and act as if it did, and place the burden on you to prove otherwise."

> No, you haven't. You've merely failed to locate any. You've said "I'm not going to prove that this works. I'm going to assume that it does and act as if it did, and place the burden on you to prove otherwise."

Excellent point. It's not even known if we can get any inconsistencies without making this definition; and it's known that, if it's true that we can't get any inconsistencies without it, then we can't prove that it's true. Building on such possibly shaky foundations can't make them stronger.

Post reply on HN