Live data from Hacker News

1/0 = 0

hillelwayne.com

1–10 of 593 posts

Re: 1/0 = 0

#4
I mean sure Pony, but as a programmer this result would surprise me quite a lot, which I tend to view as a bad thing.

https://en.wikipedia.org/wiki/Principle_of_least_astonishmen...

However:

> One of developers of Pony reached out to me. They’re planning on writing a more in-depth explanation of why Pony chose 1/0 == 0, which I will linked when available. As I understand it, it’s because Pony forces you to handle all partial functions. Defining 1/0 is a “lesser evil” consequence of that.

I am looking forward to this write up.

Re: 1/0 = 0

#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 domains into something else to get a funny result, like 1/0 = 0.

He gets to that point here:

" We can say that division’s domain is all the real numbers except zero. This is what we do in our day-to-day lives, and the way that Agda and Idris handle division. We can choose some value that isn’t a real number, such as “undefined” or infinity, and say x/0 = . This is what some mathematicians do with the Riemann sphere. We could choose some real number, like 19, and say that x/0 = 19. This is what Isabelle, Lean and Coq do.

"

So, tiny change in definition --> big change in outcome.

*I'm an undergrad

Re: 1/0 = 0

#7
> But is Pony doing something unsound? Absolutely not. It is totally fine to define 1/0 = 0. Nothing breaks

It actually does break something, the symmetry between division and multiplication and the many pieces of code that assume that (x / y) * y equals x. Here is a naive and non practical example, but it is not impossible to find a real world example where this simplified code manifests itself accidentally or by design

  function do_something_with_x(x, y) {
    let ratio = x / y;
    if (do_something_with_ratio(ratio)) {
      return x * y;
    }
    else return null;
  }
Again, this is a naive example but one that could manifest itself with a very imprecise result when y = 0

Re: 1/0 = 0

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

Re: 1/0 = 0

#10

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.

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

And dividing by 0.5 is breaking into how many pieces exactly?

Post reply on HN