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

*To*: dyer@eagle.sharebase.com*Subject*: bounded, infinite ranges?*From*: Stavros Macrakis <macrakis@osf.org>*Date*: Mon, 26 Oct 1992 14:52:37 -0500*Cc*: andyw@ibeam.ht.intel.com, dyer@eagle.sharebase.com*Cc*: info-dylan@cambridge.apple.com*In-reply-to*: Scot Dyer's message of Thu, 22 Oct 92 14:29:10 PDT <9210222129.AA01117@eagle.sharebase.com>*Sender*: macrakis@osf.org

Dyer writes: ... enumerating a finite rational range would be quite time-intensive, and would require some special form, since it wouldn't (in all probability) fit in memory on most machines. Also, generating the members of a rational range in sequential order (each new one greater or lesser for the whole range) is more of a trick than for floats... I don't see any problem here. Although any non-trivial _interval_ contains an infinity of rationals, a Dylan _range_ has an explicit step. A range from A/B by C/D consists simply of A/B + i*C/D (call that R[i]). Presumably, you calculate R[i] by first expressing A/B and C/D over a common denominator: G = GCD(B,D) N[0] = A*D/G D = B*D/G Del = C*B/G Then, N[i+1] = N[i] + Del R[i] = (N[i] / GCD(N[i],D) ) / (D / GCD(N[i],D)) -s

**References**:**Re: bounded, infinite ranges?***From:*dyer@eagle.sharebase.com (Scot Dyer)

- Prev by Date:
**setter problem** - Next by Date:
**Re: setter problem** - Previous by thread:
**Re: bounded, infinite ranges?** - Next by thread:
**Dylan Constants** - Index(es):