4 ms·
I think this is a bit different. Pony's div is total, and in order to be total div by 0 is 0, which is not a particularly absurd idea. That said, I do feel tha
by staticassertion 5y ago
I think this is a bit different. Pony's div is total, and in order to be total div by 0 is 0, which is not a particularly absurd idea.
That said, I do feel that Pony should have added a 'panic' concept and then forced actors to handle panics, but that's me.
- deleted 5y ago[deleted]
- kibwen 5y ago> which is not a particularly absurd idea It's not completely untenable, but it's still kinda janky. I've never heard of any mathematical argument that justifies division by zero yielding 0; contrast 0^0, which at least has an argument for yielding 1: http://mathscitech.org/articles/zero-to-zero-power http://mathscitech.org/articles/zero-to-zero-power
- duskwuff 5y ago> I've never heard of any mathematical argument that justifies division by zero yielding 0 0/x = 0 for all x except zero; defining 0/0=0 removes that exception.
- AlbinNP 5y agox/x = 1 for all x except 0; defining 0/0 = 1 removes that exception.
- staticassertion 5y agoI think it's worth all getting on the same page on the fact that math is fake and stupid. If it's more useful for 0/0 to == 0, that's justification enough imo.
- deleted 5y ago[deleted]
- remexre 5y agohttps://www.hillelwayne.com/post/divide-by-zero/ https://www.hillelwayne.com/post/divide-by-zero/
- noswi 5y agoFrom programming perspective, there's nothing sufficiently preposterous in the idea of dividing by zero that would require bringing the whole world to a low-level halt just for attempting that by default. You tried to calculate the average value of what turned out to be an empty list? Go suffer the most severe exception, like the ones reserved for those reading from nonexistant memory.
- Asraelite 5y agoAnother common case is adjusting some value according to a spatial vector's magnitude, like normalizing a vector or scaling gravitational attraction according to the distance between two points. In the majority of these cases the most reasonable answer is 0.
- dataangel 5y agoMaybe the best argument is that the average of zero items should be zero?
- housecarpenter 5y agoBut then why should the average of zero items be zero? It still seems like just an arbitrary choice to me.