Live data from Hacker News

1/0 = 0 (2018)

hillelwayne.com

11–20 of 245 posts

Re: 1/0 = 0 (2018)

#11
I set this to zero and print a warning/error about divide by zero on the log with data that caused it. That log would be sent to the business person worry about.

If they ignore it, I do not care, it is the business problem anyway.

Worked for me for decades :)

Re: 1/0 = 0 (2018)

#12
This article invents a new binary operation, calls it "division" and uses the "/" operator to denote it. But the article repeats multiple times that this new operation isn't a multiplicative inverse, so it's not actually division. For example, (a/b)*b=a isn't true for this new operation.

Re: 1/0 = 0 (2018)

#13
> It’s saying that Pony is mathematically wrong. This is objectively false.

Pff. The author wants to show off their knowledge of fields by defining a "division" operator where 1/0 = 0. Absolutely fine. I could define "addition" where 1 + 2 = 7. Totally fine.

What I can't do is write a programming language where I use the universally recognised "+" symbols for this operation, call it "addition" and claim that it's totally reasonable.

Under the standard definition of division implied by '/' it is mathematically wrong.

What they obviously should have done is use a different symbol, say `/!`. Obviously now they've done the classic thing and made the obvious choice unsafe and the safe choice unobvious (`/?`).

Re: 1/0 = 0 (2018)

#14
post #5

Honestly this hurts my head but Hillel is inevitably correct. You can define an explicitly undefined operation to do whatever you like. But what’s the point? There’s no new mathematics you can do with it, no existing behaviours you can extend like this. Normally, when you divide by a small number, you get a large number. Now for some reason it goes through zero. Why not five? Why not seven? Just because it’s formally…

Because exceptions are expensive, and functions with holes are dumb.

"Dumb" is purely a matter of aesthetic preference. Calling things "dumb" is dumb.

> Normally, when you divide by a small number, you get a large number. Now for some reason it goes through zero.

Zero is not a "small" number. Zero is the zero number. There is no number that is better result than 0 when dividing by 0; "Infinity" is not a real (or complex) number. This itself is GREAT reason to set 1/0 = 0. It only ever bothers people who conflate open sets with closed sets, or conflate Infinity with real numbers, so it's good have this pop up to force people to think about the difference.

Re: 1/0 = 0 (2018)

#15
post #3

As long as lim(1/x)_x->0 = inf, 1/0 = 0 doesn't make a whole lot of sense, mathematically speaking. I might be wrong but I don't think it was addressed in the article either.

There's a great Radiolab episode[0] that talks about divide by zero in perhaps more conceptual terms. KARIM ANI: If you take 10 and divide it by 10, you get one. 10 divided by five is two. 10 divided by half is 20. The smaller the number on the bottom, the number that you're dividing by, the larger the result. And so by that reasoning ... LULU: If you divide by zero, the smallest nothingness number we can conceive of…

Then take 10 and divide it by -10 = -1. 10 / -5 = -2. 10 / -0.5 = -20. So from the other side of the y-axis it behaves the exact opposite. It goes to minus infinity. So at x=0 we would have infinity and minus infinity at the same time. Imho that is why it is undefined.

Re: 1/0 = 0 (2018)

#16
post #15

Earlier quoted context omitted.

There's a great Radiolab episode[0] that talks about divide by zero in perhaps more conceptual terms. KARIM ANI: If you take 10 and divide it by 10, you get one. 10 divided by five is two. 10 divided by half is 20. The smaller the number on the bottom, the number that you're dividing by, the larger the result. And so by that reasoning ... LULU: If you divide by zero, the smallest nothingness number we can conceive of…

Then take 10 and divide it by -10 = -1. 10 / -5 = -2. 10 / -0.5 = -20. So from the other side of the y-axis it behaves the exact opposite. It goes to minus infinity. So at x=0 we would have infinity and minus infinity at the same time. Imho that is why it is undefined.

on computers you can have negative zeros

Re: 1/0 = 0 (2018)

#17
post #3

As long as lim(1/x)_x->0 = inf, 1/0 = 0 doesn't make a whole lot of sense, mathematically speaking. I might be wrong but I don't think it was addressed in the article either.

[deleted]

Re: 1/0 = 0 (2018)

#18
I debated this with my boss at my first programming job (this was 20+ years ago). He thought 1/0 should be 0 rather than an error because "that's what people expect". My argument was from mathematical definitions (the argument which this blog post picks apart).

In retrospect, I see his point better - practical use trumps theory in most language design decisions.

I haven't changed my mind but the reason has shifted more toward because "it's what a larger set of people expect in more situations" rather than mathematical purity.

Re: 1/0 = 0 (2018)

#19
post #3

As long as lim(1/x)_x->0 = inf, 1/0 = 0 doesn't make a whole lot of sense, mathematically speaking. I might be wrong but I don't think it was addressed in the article either.

There's a great Radiolab episode[0] that talks about divide by zero in perhaps more conceptual terms. KARIM ANI: If you take 10 and divide it by 10, you get one. 10 divided by five is two. 10 divided by half is 20. The smaller the number on the bottom, the number that you're dividing by, the larger the result. And so by that reasoning ... LULU: If you divide by zero, the smallest nothingness number we can conceive of…

It's even worse than that. The other issue is what happens when you've got a negative number as the numerator (number on top). Then the smaller the denominator (number on bottom) the more negative the result. -10/10 = -1. -10/5 = -2. -10/2 = -20. So if you divide by zero, it's obviously negative infinity! And it's positive infinity! At the same time.

Re: 1/0 = 0 (2018)

#20
Note 1/0 (or x/0 with x>0) isn't undefined or an exception in 754 FP math, it's +infinity. It's 0/0 that's the problem. Defining 1/0=0 isn't really helpful imho.
Post reply on HN