Possible additions to SRFI 278
Jeronimo Pellegrini 08 Sep 2026 17:53 UTC
Hello.
I wonder if it wold make sense to also add these to this SRFI:
1. sqrt and log that work for bignums whenever possible.
These are described here:
https://github.com/schemedoc/surveys/blob/master/surveys/log-requires-floating-point.md
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...
One other thing, that may not be worth the trouble:
3. trigonometric functions that work with bignums
(sin (expt 3 100)) => 0.97296091498912577934513662068382132471
(cons (expt 3 100)) => -0.23096982033054266190959244255763104565
(tan (expt 5 100)) => -0.23947636232539180595805739858897233713
These need range reduction, and for that to work one likely needs
a high precision value of PI... And how much precision would depend on
the size of the bignum, so it would be easy with a library like MPFR
(but then, just delegate the whole operation to MPFR) and hard without
it - that's why I said maybe not worth it.
J.