4 ms·
I remember seeing a rather convincing argument that 1.0/0.0 should not be infinity, but zero.
by mark-r 7y ago
I remember seeing a rather convincing argument that 1.0/0.0 should not be infinity, but zero.
- jolmg 7y agoYou mean mathematically, or specifically for programming? For programming, I imagine it's better for it to be infinity than 0 since having 0 in the denominator implies that it's changing (who would write a constant 0 in a denominator?), and so as the denominator is approaching 0, the fraction is getting closer and closer to pos/neg infinity, not 0. Making it evaluate to zero would imply a change of direction for whatever the fraction represents. So, if it's a position, as the position goes 1000/1000, 1000/500, 1000/100, 1000/1, etc. it's getting closer to infinity. Having it suddenly go to 0 would break the pattern of movement. Mathematically, there is no x that satisfies x = 1/0 -> x * 0 = 1, since anything multipled by 0 is 0, so it's undefined.
- mark-r 7y agoYes, there's a discontinuity between the positive and negative numbers, that was part of the argument. Another part was that certain mathematical formulas get simpler when x/0 = 0.
- smabie 7y agoDo you remember seeing or do you remember?
- mark-r 7y agoIt was something on the internet. I wish I could come up with the proper search terms to find it again.
- QuinnWilton 7y agoThis is how Pony handles division. There's a good summary of possible motivations here: https://www.hillelwayne.com/post/divide-by-zero/ https://www.hillelwayne.com/post/divide-by-zero/
- QuinnWilton 7y agoI pasted the wrong link above, but my mobile app isn't letting me edit it. This is the link that describes their reasoning: https://tutorial.ponylang.io/gotchas/divide-by-zero.html https://tutorial.ponylang.io/gotchas/divide-by-zero.html
- mark-r 7y agoThank you! The mention of Pony gave me just enough ammunition to search for the article I remembered seeing. https://news.ycombinator.com/item?id=17736046 https://news.ycombinator.com/item?id=17736046 P.S. the link you provided is exactly the one.