Talk:Detect division by zero: Difference between revisions
Content added Content deleted
(0 / 0 = x where 0 * x = 0) |
(Pedantism) |
||
Line 15: | Line 15: | ||
: 0 / 0 is NOT mathematically incalculable -- it is trivially calculable. The problem with 0 / 0 is that any numerical answer is a valid answer. In other words NaN is not a valid result for 0 / 0 but is a description of the character of those answers. (The result can be any of an infinite variety of numbers and not just "a" single number.) This is a problem in mathematics because the result, by itself, is not sufficient to prove anything. Thus, we at times use limits and other constructs to reason about cases involving 0 / 0. A less deceptive result than NaN for 0 / 0 would be "Any Number", but to my knowledge no languages implement that. --[[User:Rdm|Rdm]] 18:19, 18 June 2010 (UTC) |
: 0 / 0 is NOT mathematically incalculable -- it is trivially calculable. The problem with 0 / 0 is that any numerical answer is a valid answer. In other words NaN is not a valid result for 0 / 0 but is a description of the character of those answers. (The result can be any of an infinite variety of numbers and not just "a" single number.) This is a problem in mathematics because the result, by itself, is not sufficient to prove anything. Thus, we at times use limits and other constructs to reason about cases involving 0 / 0. A less deceptive result than NaN for 0 / 0 would be "Any Number", but to my knowledge no languages implement that. --[[User:Rdm|Rdm]] 18:19, 18 June 2010 (UTC) |
||
::Maybe it's correct as multiple numbers are '''N'''ot '''a''' '''N'''umber :-)<br> (Being pedantic seems to be catching). --[[User:Paddy3118|Paddy3118]] 18:37, 18 June 2010 (UTC) |
Revision as of 18:37, 18 June 2010
Many of the solutions here simply check that the result is infinite. This will fail if the numerator is 0 too, since 0 / 0 is mathematically incalculable (many languages return NaN here).
A correct pseudocode solution is:
result = numerator / denominator if numerator equals 0 if result is not a number divide by zero action end else if result is infinite divide by zero action end end
- 0 / 0 is NOT mathematically incalculable -- it is trivially calculable. The problem with 0 / 0 is that any numerical answer is a valid answer. In other words NaN is not a valid result for 0 / 0 but is a description of the character of those answers. (The result can be any of an infinite variety of numbers and not just "a" single number.) This is a problem in mathematics because the result, by itself, is not sufficient to prove anything. Thus, we at times use limits and other constructs to reason about cases involving 0 / 0. A less deceptive result than NaN for 0 / 0 would be "Any Number", but to my knowledge no languages implement that. --Rdm 18:19, 18 June 2010 (UTC)
- Maybe it's correct as multiple numbers are Not a Number :-)
(Being pedantic seems to be catching). --Paddy3118 18:37, 18 June 2010 (UTC)
- Maybe it's correct as multiple numbers are Not a Number :-)