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

*To*: srfi-33@xxxxxxxxxxxxxxxxx*Subject*: Late request for additional functions*From*: Brad Lucier <lucier@xxxxxxxxxxxxxxx>*Date*: Sun, 13 Apr 2003 16:28:28 +0200*Delivered-to*: srfi-33@xxxxxxxxxxxxxxxxx*Old-date*: Sat, 12 Apr 2003 14:36:13 -0500 (EST)*User-agent*: Gnus/5.090017 (Oort Gnus v0.17) XEmacs/21.5 (cabbage, berkeley-unix)

Olin (and others): I was looking at iterative bignum algorithms for calculating pi and other things last week. In such algorithms, one would like to say: stop the general iteration if two approximations a and b, each of length n bits, agree to at least their most significant n/2 bits (then you execute a cleanup operation). One would like to do this without actually subtracting the two numbers, which generally leads to n bits of garbage. This is a fairly common operation in iterative algorithms for integer division, square root, etc., and algebraic-geometric mean (AGM) algorithms. So I propose two new functions (modulo naming) (least-significant-bit-difference a b) => a number or #f (most-significant-bit-difference a b) => a number or #f The first function would return the location (index) of the least significant bit that was different between the two integers, or #f if a and b are equal. The second function would return the location (index) of the most significant bit that was different between the two integers, or #f if one of a and b is nonnegative and the other is negative. Brad

- Prev by Date:
**Resuming SRFI-33 discussion** - Next by Date:
**Reviving SRFI 33** - Previous by thread:
**Resuming SRFI-33 discussion** - Next by thread:
**Reviving SRFI 33** - Index(es):