
On 11 Jan 2008, at 11:25 PM, Achim Schneider wrote:
Jonathan Cast
wrote: On 11 Jan 2008, at 10:12 AM, Achim Schneider wrote:
David Roundy
wrote: Prelude> let x=1e-300/1e300 Prelude> x 0.0 Prelude> x/x NaN
The "true" answer here is that x/x == 1.0 (not 0 or +Infinity), but there's no way for the computer to know this, so it's NaN.
Didn't catch this the first time around, but: only to a physicist. (I mean no disrespect to the author of darcs, but nevertheless the point stands). Back in the real world, 0 / 0 may be defined arbitrarily, or left undefined. (Defining it breaks the wonderful property that, if lim (xn) = x, lim (yn) = y, and x/y = z, then lim (xn / yn) = z. This is considered a Bad Thing by real mathematicians). In fact, in integration theory 0 * inf = 0 for certain 'multiplications', which gives the lie to 0 / 0.
whereas lim( 0 ) * lim( inf ) is anything you want, or, more precisely, the area of the thing you started with.
I think you're thinking of the Riemann integral (I was thinking of the Lebesgue integral, and in particular the definition of the integral for step functions). That integral can be informally characterized as the sum of infinitely many terms, each zero (it's a limit of finite sums, where the largest (in the sense of absolute value) term in each sum goes to 0 as the sequence proceeds). That's scarcely a rigorous characterization, and it overlooks a ton of issues (like the fact that neither an infinite sum nor a sum identically 0 terms is actually involved), and it's scarcely relevant to the numerical analysis question of what 0/0 should return except to point out that any definition is going to make *somebody*'s algorithm silently go wrong... jcc