On Mon, Oct 14, 2002 at 08:25:43PM -0400, Mark J. Reed wrote:
> On 2002-10-14 at 20:15:33, Michael G Schwern wrote:
> > There are several verbal proofs why 1/0 is not +Infinity here:
> > http://mathforum.org/dr.math/faq/faq.divideby0.html 
>
> Yeah, that would be why I sent my followup.   I did not mean to
> imply that 1/0 is positive infinity in "real world math".

Sorry, I was a little too fast on the reply gun.


> However, returning Infinity when asked to divide a finite 
> number by 0 is conformant behavior according to the IEEE spec.
> An implementation is *allowed* to indicate an error on division
> by 0, but is not *required* to - returning infinity is legal.

<snip>

> It is also, as an example, the behavior required by the ECMAScript
> specification.

Heh.  "Because Javascript does it" is supposed to be an argument for? ;)


> In any case, my point was simply that 1/0 is not NaN.  If you're going to
> return a defined value as the result of 1/0, you should return +Infinity
> instead.

Mathematically, 1/0 is not +Infinity.  It's undefined/indeterminate in the
set of rational numbers.  The IEEE may say otherwise.

So here's a big question.  Should Perl's core maths conform to IEEE or
mathematics?  (Not something I expect an answer to.)


> NaN is used for other purposes, such as square roots of negative
> numbers when complex numbers are not available, or as the return value
> of failed numeric coercions, or of operations where even as a limit the
> result is indeterminate, such as 0/0.

So NaN means "this equation might have an answer, just not in your current
set of numbers" and it means "a coercion failed" and it means "the limit is
indeterminate"?  A lot of meanings.  But it doesn't mean 1/0?


This gets into questions of how Perl's math systems are extended/overridden.
Something better suited to guys like Tels I guess.  While I'd personally
like built-in support for automatic bignum conversion, I suppose the best
answer I could expect right now would be "Perl 6's support for additional
maths will be greater than or equal to Perl 5".


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl Quality Assurance      <[EMAIL PROTECTED]>         Kwalitee Is Job One
I'm a man, but I can change... if I have to.
    -- Red Green

Reply via email to