[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: email@example.com
- Subject: Rational Infinity
- From: Robert A. Cassels <Cassels@STONY-BROOK.SCRC.Symbolics.COM>
- Date: Tue, 10 Feb 87 10:33 EST
- Cc: firstname.lastname@example.org
- In-reply-to: <8702060633.AA03285@bhopal.edsel.com>
Date: Thu, 5 Feb 87 22:33:00 PST
From: email@example.com (Jon L White)
Re: The existence of infinite rational objects and how they come about are
two separate issues. . . .
Very good point.
Re: . . . One of the reasons that
rational infinities aren't in Common Lisp yet is that there is some
debate about whether rational infinity is affine (signed) or projective
Although Common Lisp doesn't require IEEE floating-point capability, I
think most people would agree that it's a reasonable goal to reach for.
For compability with the infinities available there, one would like to
have both +1/0 and -1/0 (I presume we can agree on a canonical form
for a rational infinity, that its denominator should be 0 and its
numerator's magnitude should be 1 ?)
The fact that your floating-point has a representation of infinity
doesn't need to imply that rational numbers do. Floating-point gets
along just fine by itself. Note that the contagion rules specify that
if (IEEE) floating infinity is combined arithmetically with a rational
number, the result is floating-point. The user must explicitly coerce
floating-point numbers to rational, and it could just be an error to
coerce an infinity to rational. [That's what we do at Symbolics.]
IEEE floating-point infinities serve two purposes -- to represent the
results of overflow, and to represent the results of some "illegal
operations" (like 1.0/0.0). That's probably the best reason for not
introducing rational infinities. Since rational arithmetic doesn't
overflow, associating rational infinities with IEEE infinities would
confuse the distinction between the two IEEE uses of infinity.
The only reasons I can see for rational infinities are:
1. Some algorithms like to have "infinities" for use in comparisons.
2. You want something to do when the user attempts to coerce a
floating infinity to rational, other than signal an error.
3. You really want arithmetic in a rational domain which includes
1 is an okay reason, but NIL and T can serve almost as well. IEEE
infinities can be used just as easily, if you make mixed-mode
comparisons do the right thing. [If you blindly coerce to
floating-point, you may overflow a large rational value to a floating
Supposing that you decide that 2 is your reason. Then you also need a
way to represent NaNs. I suppose the natural representation is 0/0, but
that seems to be going a little far.
3 would be a fine reason, but then you have to deal with the
affine/projective question, and you've gotten far away from your
original goal. [And farther out on a limb than I'm willing to go.]
-- JonL --