Re: Possible additions to SRFI 278
Bradley J Lucier 09 Sep 2026 02:58 UTC
> On Sep 8, 2026, at 1:53 PM, Jeronimo Pellegrini <xxxxxx@aleph0.info> wrote:
>
> 2. exact-integer-log, similar to exact-integer-sqrt, for completeness.
>
> (exact-integer-log (expt 2 120) 3)
> => values:
> 75
> 720961208071558163784123067661483269
>
> Well, just a suggestion, but it does make sense to me…
This reminds me that Gambit has integer-nth-root (should really be called exact-integer-nth-root), but without a remainder:
> (integer-nth-root 40 3)
3
It’s used in certain exponential operations:
> (expt 8/27 2/3)
4/9
integer-nth-root is useful, it might be more useful if it returned the root with remainder.
Gambit uses an algorithm based on Newton’s method; it’s not as optimally fast as "Karatsuba Square Root" by Paul Zimmermann is for square root, but it’s OK.
Brad