# Re: bounded, infinite ranges?

• To: macrakis@osf.org
• Subject: Re: bounded, infinite ranges?
• From: andyw@ibeam.ht.intel.com (Andy Wilson)
• Date: Tue, 20 Oct 92 14:16 PDT
• Cc: info-dylan@cambridge.apple.com

```--------------------------------------------------------------

...My reason: a range is over floats, yes?  Therefore no
enumerative approach would terminate (any range has an infinite
number of elements), even if one was provided.

Huh?  Floats are not reals -- after all, they're represented finitely.
---------------------------------------------------------------

Absolutely right -- which is why I originally asked the question
about ranges where one of the bounds is infinity.  Actually, there's
a much more mundane question about ranges with float bounds: what
is the (size) of such a range, which is defined in the April '92
book as an integer.

Naively, one might assume that (size range) could be defined as
(/ (- (top range) (bottom range)) (by range)).  However, since
floats are in fact represented finitely, if the "by:" step size
for range is sufficiently small there might well be too few
allowable bit patterns to represent the theoretical number of
intervals in the range.

You could define away this problem by requiring by:, from:, up-to:
and through: to be rational, thus making the size calculation
exact.

BTW, I'd still like an answer on the other question about Dylan
syntax for infinities and NaN's.  Any takers?

atw

```