Live data from Hacker News

1/0 = 0

hillelwayne.com

71–80 of 593 posts

Re: 1/0 = 0

#71

While I fully agree, I'd like to point out that reducing specifically to 0/0 = 0 is more generally useful (ie. maintains intuition) than x/0 = 0, which breaks intuition. Given a/b = c, your intuition of finding c is to get a number such that c×b = a. c×0 = 0 has an infinite number of solutions, 0 being a particularly practical one. c×0 = 1 (and more generally a≠0) has no solution, especially in the reduced explanatio…

But this is not for man of industry!

Re: 1/0 = 0

#72
My problem with "1/0 = 0" is that it's essentially masking what's almost always a bug in your program. If you have a program that's performing divide-by-zeroes, that's almost surely something you did not intend for. It's a corner case that you failed to anticipate and plan for. And because you didn't plan for it, whatever result you get for 1/0 is almost surely a result that you wouldn't want to have returned to the user.

When encountering such unanticipated corner cases, it's almost always better to throw an error. That prevents any further data/state corruption from happening. It prevents your user from getting back a bad result which she thinks she can trust and rely on. It highlights the problem very clearly, so that you know you have a problem, and that you have to fix it. Simply returning a 0 does the exact opposite.

If you're one of the 0.1% who did anticipate all this, and correctly intended for your program to treat 1/0 as 0, then just check for this case explicitly and make it behave the way you wanted. The authors of pony are welcome to design their language any way they want. But in this case, they are hurting their users far more than they are helping.

Re: 1/0 = 0

#73

Earlier quoted context omitted.

1/0 = undef (cast to 0) 1 != 0*0 I don't see the inconsistency. Abstract math vs practical application.

You’re doing something different than real number arithmetic. Saying 1/0 = x, and then treating x like a real number is inconsistent. But just saying “we are going to augment the real numbers with an element x that is not a real number, and then define some properties of x and prove things about it” is not.

> You’re doing something different than real number arithmetic

Computer languages execute on rules that are not utilizing real number arithmetic. I didn't want to mention it, but there's these things called floats...

Edit: Pony took out the "normal" version of division by zero and suggest to write a wrapper to check beforehand.

Re: 1/0 = 0

#74
post #57

> But is Pony doing something unsound? Absolutely not. It is totally fine to define 1/0 = 0. Nothing breaks a=x/N b=y/N If a==b, then x==y No longer true, with this change. Essentially a variety of mathematical properties of numbers in the Real space don't hold when you allow division by 0.

well, as long as you aren't doing calculus

Re: 1/0 = 0

#75

Unlike what the author says, this is the total opposite to a practical/pragmatic solution. He does not prove that this is a useful representation, only that given his own axioms, this can be considered mathematically correct. Very practical issues with 1/0 == 0: - This result is counter-intuitive, took building a custom fields and responding to the incredulity of all. - The main reason this is counter-intuitive is no…

Were are speaking of integers here not FP numbers.

Re: 1/0 = 0

#76

You know.. dividing is like breaking something up.. If you divide by 2, you break it up into 2 pieces.. if you divide by 0, from some standpoints, you do have nothing, because you broke it up into 0 pieces, and 0 pieces is 0.

I mean, you’re not wrong. Not right either (for technical reasons), but that kind of argument leads you to mathematical objects like the Cantor set: a set of line segments with zero total length. Mathematically, you have a bunch of objects; practically, you have nothing.

Re: 1/0 = 0

#77
post #71

While I fully agree, I'd like to point out that reducing specifically to 0/0 = 0 is more generally useful (ie. maintains intuition) than x/0 = 0, which breaks intuition. Given a/b = c, your intuition of finding c is to get a number such that c×b = a. c×0 = 0 has an infinite number of solutions, 0 being a particularly practical one. c×0 = 1 (and more generally a≠0) has no solution, especially in the reduced explanatio…

But this is not for man of industry!

It is stunningly practical.

Re: 1/0 = 0

#78

Earlier quoted context omitted.

Wait, if 1 / 0 = infinity, then infinity * 0 = 1 This seems just as bizarre, since zero times anything shouldn't become 1, no matter how big or how many times you do it.

Yes, that's correct. The fact that 1/0 shouldn't be defined as infinity isn't an argument that it should be defined as 0.

There are many contexts where defining either 1/0 = -1/0 = ∞ or 1/0 = +∞ and –1/0 = –∞ is better than the alternatives, especially when working in an approximate number system like floating point.

In geometric modeling kinds of applications, I would say that these definitions are typically desirable, with 1/0 = undefined only better in unusual cases. As a simple example, it is typically much more useful for the “tangent” of a right angle to be defined as ∞ than left undefined.

But anyhow, there are no “facts” involved here. Only different choices of mathematical models, which can be more or less convenient depending on context / application.

Re: 1/0 = 0

#80
> 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.

There is no proof in this post that 1/0 = 0 maintains consistency. Rather, it contains refutations of one or two arguments that claim inconsistency, along with appeals to authority.

Post reply on HN