[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bounded, infinite ranges?


   ...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

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