4 ms·
Zero Divided by Zero (2003)
- mehrdada 11y ago> ((D%C)+(B%C)) = (D+B) % C This is wrong. You need an extra %C on the left hand side for that identity to work: ((D%C)+(B%C))%C = (D+B) % C
- TazeTSchnitzel 11y agoI prefer the IEEE 754 solution: NaN.
- Zekio 11y agoThat definition is technically true since it is equal to a black hole inside a black hole.
- TheLoneWolfling 11y agoI find that the bane of my existence. It is far better in almost all cases to have it be something vaguely sensible than to have it pop out a virus that infects everything down the line.
- TazeTSchnitzel 11y ago> I find that the bane of my existence. Then don't use it. You can trap it, you know. > It is far better in almost all cases to have it be something vaguely sensible than to have it pop out a virus that infects everything down the line. It isn't better, because now your program produces incorrect results and you don't know about it.
- TheLoneWolfling 11y agoFor game programming, it is decidedly better to produce subtly incorrect results, at least on a release build, than NaN everywhere.
- yoklov 11y agoIn game programming you want it to be 0 as often as you want it to be 1 (or really, less often). Just write a safeDiv function that takes an argument for what the result should be if the denominator is zero.
- jordigh 11y agoNo. 0/0 cannot be logically given a real value. Make your NaNs signalling if it's a problem. Raise an exception like Python does by default, or warn like modern numpy does. But don't make 0/0 complete and absolute contradictory nonsense like a real value.
- jordigh 11y agoI read the introduction. They want to assign a real value to 0/0. From a flawed premise no true conclusion can be drawn, so I stopped reading.
- effie 11y agoI share your sentiment, just a nitpick: from a flawed premise any conclusion, true or false, can be drawn. http://academic.csuohio.edu/polen/LC9_Help/1/14ftv.htm http://academic.csuohio.edu/polen/LC9_Help/1/14ftv.htm