Front page | perl.perl6.language |
Postings from October 2002
Re: Indeterminate math
From:
Larry Wall
Date:
October 14, 2002 17:38
Subject:
Re: Indeterminate math
Message ID:
Pine.LNX.4.44.0210141732230.23345-100000@london.wall.org
On Mon, 14 Oct 2002, mosullivan@crtinc.com wrote:
: From: Mark J. Reed mark.reed@turner.com
: > Summary of values:
: >
: > 1/0 +Inf
: > -1/0 -Inf
: > 0/0 NaN
: > Inf/0 NaN
: > Inf/Inf NaN
:
: Are Inf and NaN going to be standard in Perl 6?
I don't know if they're "standard", but it has to be drop-dead easy to add them.
: As long as we're traveling
: down that road, how about i (the square root of -1), or Lukasiwiscean Null?
: (Sorry if I sound sarcastic, I'm actually honestly curious.)
Obviously complex arithmetic is important to a sizable set of people, and
they want it to be fast.
: My inner Larry Wall is right now saying that there needs to be a more
: generalized solution to all this. OK, here's one. By default, anything/0
: throws an exception. However, you can load modules to handle those
: exceptions, substituting Inf, NaN, or whatever as the evaluation of the
: expression.
You can control how things compile in a lexical scope via pragma,
and you can control how division is implemented for a class via
overloading. That's probably enough control to get wherever you want
without implicitly throwing and catching exceptions.
Larry