In my language, division isn't closed. The type of x/y is maybe<double> because when you do shenanigans of defining division as a different operator than multiplying by the multiplicative inverse, your code sucks.
But pony wants to avoid exceptions in all cases to guarantee progress, and nan and inf cannot be computed on. /0 needs special branches to be handled by the user, not the compiler.
Hear me out: while the process of dividing a number by zero is "infinity" or "Nan", logically speaking, taking something and dividing into nothing, with the stipulation that a non-infinite method of doing so is found, will result in a zero.
I say that because essentially, the divisor '0' predetermines the outcome. it is impossible for anything to be divided into "nothing" pieces and result in something.
Dividing by 1 is similar, you can't split an apple of size 1 into "size 1" sized pieces and get any less or more than a "size 1" apple. In a similar way, if you are able to split an apple of "size 1" into "no apple" slices, it is impossible by the bare rules of the logic of reality to get any less or more than "no apple". You won't get infinite apples, if you do, then the stipulation of the divisor '0' becomes incompatible. anything other than 0 is incompatible.
If the physical law of our inability to create or destroy matter or energy did not exist, we could probably prove this as true.
But destruction aside, here is a fun philosophical argument: If I take an apple and burn it until it can no longer be considered an apple, did I just divide that apple by 0?
(I'm just putting my reasoning out there, I know nothing of proper mathematics. Be gentle!)
I hear you. And my first thought is: infinity times 0 does not equals 0.
The thing is, I have a different understanding of "division". I see it as numerator and fraction. 1/4 means there is one of two pieces. You could have 4 pieces of cake, but only 1 is present. If the cake is empty, it's 0/4. 5/4? Someone added an additional peace of cake.
4/0? There's no cake at all. You can't have something of something that is not there. It's not 0, because 0 is a number. It's simply not defined. Non existent.
And I don't see the argument here:
> If I take an apple and burn it until it can no longer be considered an apple, did I just divide that apple by 0?
It may not be an apple anymore, but it's still matter + energy. Actually you didn't changed anything.
> 4/0? There's no cake at all. You can't have something of something that is not there. It's not 0, because 0 is a number. It's simply not defined. Non existent.
0 is a number that denotes non-existence though right? so it is adequate there. you can have nothing after the division for something that *was* there prior to the division, which is the purpose of zero. You can't have '0' of something that *is* there, the purpose of zero is to enumerate non-existence.
> It may not be an apple anymore, but it's still matter + energy. Actually you didn't changed anything.
It is still in existence, but it's number is zero because it is no longer an apple. it is no longer some count of an apple, it is no longer any count of an apple, it is something else, but not an apple, so it is zero apples, a successful division by zero!
reply