Live data from Hacker News

1/0 = 0

hillelwayne.com

321–330 of 593 posts

Re: 1/0 = 0

#321
post #141

You lose simple properties of division, such as (a + b)/c = a/c + b/c. If you set 1/0 = 1 (as the author claimed causes no inconsistency), then (2 + 1)/0 = 2/0 + 1/0 is false If you come to rely on division by zero behaving a certain way (as happens to all features/bugs of any language), then suddenly silly decisions about how to implement a formula can cause wildly different behavior. Good luck refactoring!

(a + b)/c = a/c + b/c for c ≠ 0. Otherwise it has no meaning.

Therefore (2 + 1)/0 = 2/0 + 1/0 is not even false, it just means nothing.

BTW, you didn't mention Infinity explicitly, but it would lead to the same inconsistency, if you think about it:

(2 - 1)/0 = 2/0 - 1/0

:)

Re: 1/0 = 0

#322

Please forgive my tone, it's not keeping in the noble spirit of Hacker News. But here goes: So that's it. I read your proof. You try cloaking it in pseudo-mathematical formulation, but what you are really doing is defining division as a derived operator, rather than the axiomatic operator it is in mathematics. I can say 1= infinity in my universe and as long as I am consistent, it is sound. You're saying this is a us…

The OP didn't invent the definition of fields as defined by additional and multiplication, with division defined as the Inverse of multiplication. Even the Wikipedia article on fields (https://en.wikipedia.org/wiki/Field_%28mathematics%29#Defini...) defines them this way. (Not that Wikipedia is an authority on truth, but I find that it's a pretty good indicator of what positions are common/widespread regarding a subject.) It's a bit silly to claim that division is defined as axiomatic "in mathematics" given how fundamental fields, defined as the OP defined them, are to modern number theory and mathematics in general.

Re: 1/0 = 0

#323

This thread is showing once again that reading comprehension is not our strong-suit here on HN. The author does not once say that Pony's choice is a good one, only that whether it is a good or bad one should be settled by engineering consequences, and that there is no purely mathematical argument that precludes it. I can't help but think it _is_ a bad idea, because it's easier to overlook a 0 appearing than a NaN. Th…

The Pony devs did chime in and mentioned that they do define division by zero to be NaN (or positive infinity) where the underlying type supports it (e.g. IEEE 754 floats). Most integer representations have no space for such a value, so the only choices available to language developers are: 1. Throw an exception or otherwise consider it an error 2. Define the result to be 0 or 1 or some other integer value (0 being t…

It sounds like from what I have learned elsewhere on here that Julia is doing something interesting here.

https://news.ycombinator.com/item?id=17737308

https://news.ycombinator.com/item?id=17737158

Re: 1/0 = 0

#324
post #312

Earlier quoted context omitted.

Is there a proof or something elsewhere you can link to? To be honest I can't really tell the point you're trying to make.

I can give you a simple proof by contradiction. 1. Let F be a field containing an element x =/= 0. 2. Suppose we have defined division by zero in F such that, for all x in F , there exists an element y = x /0 (i.e. F adheres to the field axiom of multiplicative closure). Note that at this point it does not matter how we have defined division by 0, we will just generously continue and assume you've done it in a way th…

>Since y = x/0, it follows that the product of y and 0 is equal to x, because division is the inverse of multiplication.

Can you explain how this follows? I thought division was only the inverse of multiplication for all nonzero denominators, which would mean we can't use that definition for deduction in x/0.

It might hinge on your next sentence:

>By the field axioms, division does not exist if there is no multiplicative inverse with which to multiply.

but I don't understand why that's necessarily true. I don't understand how the field axioms require division by x to require the existence of a multiplicative inverse of x when x is zero. Sorry to take a bunch of your Friday, but I'm very curious now. Explanation much appreciated.

-------

edit:

Come to think of it, couldn't I define x/y as cotton candy for all x,y in field F and still satisfy the field axioms? They just don't refer to division.

Any connection between x/y and y's multiplicative inverse is just a nice convention. That convention states that x/y = x * mult_inv(y) when y != 0, but nothing else. That definition has nothing to do with the field axioms and changing it doesn't require that I change anything about multiplicative inverses. That means I don't touch the field axioms and my field is still a field.

Re: 1/0 = 0

#325
post #45

I'm not seeing how the tweet is mocking the Pony developers. It seems to mirror the tone and the content of of the documentation in the screenshot. It looks like an absurdist spin on the ivory tower vs industry meme, and it doesn't make anyone the butt of the joke.

The screenshot in question cut off the explaination of why. I'm one of the Pony developers and I took it to be mocking.

Re: 1/0 = 0

#326
post #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…

I almost want two different division operations: One where 1/0 = 0, exclusively for use in progress bars and stuff like that, and another one for everything else. Because frequently division by zero indicates a bug. But similarly frequently, I end up crapping out annoying little bits of code like if (foo == 0): return 0 else: return bar / foo

[deleted]

Re: 1/0 = 0

#327

It's quite staggering how many people have posted on this thread without reading the article. Nearly all the objections people have raised are directly addressed in the post. For those who still object to the argument, would you object to me defining the piecewise function f:R->R defined to be 1/x for x =/= 0 and 0 for when x=0?

Nearly all the objections people have raised are directly addressed in the post. Are they? I see nothing in the article about the negative consequences of surprising users with silent failure, for example. Or the fact that it makes little sense in real-world scenarios. would you object to me defining the piecewise function f:R->R defined to be 1/x for x =/= 0 and 0 for when x=0? What do you mean by objecting to you d…

The post is not about whether this is a good choice for its users; the post is about whether there are nathematical objections to it. The author even writes that they don't agree with the engineering decision to define it like that, but they can't object with an appeal to mathematics. It lists three valid choices for handling division by zero and Pony picked one of them. My personal favorite is to shrink the domain but that's not supported in most languages and those that support it are often not meant for number crunching.

Re: 1/0 = 0

#328
post #297

In some languages, you could define a new division operator that returns an Optional/Option/Maybe result, and then use a nil-coalescing operator to choose what you want in case of division-by-zero. In Swift: infix operator /? : MultiplicationPrecedence extension FloatingPoint { static func /? (lhs: Self, rhs: Self) -> Self? { return rhs == 0 ? nil : lhs / rhs } } extension BinaryInteger { static func /? (lhs: Self, r…

You can't define your own in Pony but,

/?, *?, +? and -? are coming to Pony. We call them "safe math operators" and will error on integer overflow, underflow, and division by zero.

Re: 1/0 = 0

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

“Nothing breaks” in that it isn’t unsound, in that you can’t use it to prove a falsehood. Not that you can’t use the nice little shortcuts you’re used to. In practical terms, that _does_ have an impact, because people might use those shortcuts without realising the system they’re operating under doesn’t allow it. But you picked the wrong quote to make that point under.

To elaborate on the 'nice little shortcut' you mentioned, here it is:

If a==b and N≠0, then x==y

EDIT: Formatting

Re: 1/0 = 0

#330
post #296

Earlier quoted context omitted.

He's not saying that it breaks; quite the opposite, he repeatedly states that 0⁻ doesn't exist. He's just defining division in a specific way. The MI property states that every element except 0 has a multiplicative inverse. He's defining division via two cases: If b≠0, then a/b = a*b⁻ (multiplicative inverse). If b=0, then a/b=0. This definition does not imply that 0⁻ exists, so there's no violation of MI.

The problem this and the other replies miss is that the standard definition of division is multiplication by the inverse. The entire argument rests on a notational slight of hand. The property that held before -- that _when defined_ division has the inverse property -- no longer holds. Thus many equational identities that otherwise would hold do not hold.

Look at it this way...

Standard definition of division function, d:

d(x, y) = x * y⁻, for all x and y EXCEPT 0

Author's modified, piecewise (https://en.wikipedia.org/wiki/Piecewise) definition:

d(x, y) = x * y⁻, for all x and y EXCEPT 0

d(x, y) = 0, for y = 0

He's just adding 0 to the domain of d(x, y) to extend the definition, and deliberately not using xy⁻ for that particular element of the domain. No inverse needed.

Post reply on HN