Talk:Detect division by zero: Difference between revisions

m
added a section header to the first topic to properly place the table-of-contents (TOC) --- (this happens more often than one would think).
No edit summary
m (added a section header to the first topic to properly place the table-of-contents (TOC) --- (this happens more often than one would think).)
 
Line 1:
== division of zero by zero ==
 
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).
 
Line 23 ⟶ 25:
:::: Limits are such a context. <math>\lim_{n\rightarrow+0}\frac 10</math> ''converges to'' (positive) infinity. It's not ''actually'' a value per se. When performing operations and calculations this if often not done precisely (by handling the limits) but for the most part that doesn't really matter. Still, ∞ isn't part of the real numbers. —[[User:Hypftier|Johannes Rössel]] 09:27, 20 June 2010 (UTC)
::::: Ok, but everything in mathematics is based on context, though of course the interesting math is relevant in a wide variety of contexts. Nevertheless, we also have areas of mathematics where an operation logically could give any of an infinite set of results and for convenience we pick one of those results as the for that expression. One might argue that having the value of 0 for the principle value for 0/0 is not useful, but in my opinion this is akin to saying that 0 itself is not useful. Note, for example, that this approach would usually eliminate the need for knuth's "strong zero" approach at http://arxiv.org/PS_cache/math/pdf/9205/9205211v1.pdf Of course, exceptions can be constructed but they can be dealt with in much the same way as any other case that requires the use of a non-principal value. --[[User:Rdm|Rdm]] 15:02, 2 July 2010 (UTC)
 
 
== Choices in Javascript Implementation ==
 
: Can someone provide reasoning for the way JavaScript solution is implemented? To me it looks like it is simply passing back the JS result and returning 0 if the expression evaluates to NaN. It also return 0 for divByZero(4,'n'). I think we can all agree diving by a string is not 0 :). I wrote a solution but don't want to add it in case I'm not completely understanding the function :) My solution
function divzero(l,r) {
Line 32 ⟶ 37:
 
:: The task asks that division by zero be detected, but leaves open what to do at that point. The decision to return zero should be seen not as detection but as an (arbitrary but silly) decision about what to do after detection. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 14:40, 6 November 2015 (UTC)
 
== divides by zero ==
 
'''Math:'''
 
It's all fun and games until somebody divides by zero. &nbsp; &nbsp; &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 13:47, 30 November 2019 (UTC)