develooper Front page | perl.perl6.language | Postings from October 2002

Re: Indeterminate math

From:
Ken Williams
Date:
October 15, 2002 09:56
Subject:
Re: Indeterminate math
Message ID:
CA28E5EC-E05E-11D6-A7BE-003065F6D85A@mathforum.org

On Tuesday, October 15, 2002, at 07:05  AM, Michael G Schwern wrote:
> This came up at YAPC::Europe.  Someone [1] wanted to know if 1/0 would
> produce a divide by zero error in Perl 6, or if it would return a value
> representing an indeterminate result (undef?)  It would make more sense 
> for
> Perl, upon being given a simple bit of impossible math, to return undef
> (like other functions do on failure) than to generate an error.  The 
> error
> seems a throwback to earlier days of hardwired calculators.

Well, if you're an exceptions guy like me, you'd *much* rather have it 
produce an error than a zero, which I assume undef would still evaluate 
to.

NaN is another option, following some standard or other.


> [2] Discussion of divide by zero and why it's not infinity [3]
> http://mathforum.org/dr.math/faq/faq.divideby0.html
>
> [3] I was always taught it's infinity.

Positive or negative infinity?  (it's a trap!)

  -Ken




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About