I may be missing the context, but can we just rely on srfi-143 fx-greatest?  If dependency is an issue, we can cond-expand and use heuristics only when srfi-143 isn't available.



On Fri, Jan 26, 2024 at 3:01 PM Bradley Lucier <xxxxxx@purdue.edu> wrote:
On 1/26/24 5:10 PM, John Cowan wrote:
> an easier empirical approach with no external dependencies is to rely on
> the de facto property that (eq? k k) => #t iff k is a fixnum.

That doesn't work in compiled code in Gambit:

heine:~/programs/gambit/gambit-lucier> cat bignum-test.scm
(define a 1111111111111111111111111111111111111111)
(define b 1111111111111111111111111111111111111111)
heine:~/programs/gambit/gambit-lucier> gsc bignum-test
heine:~/programs/gambit/gambit-lucier> gsi
Gambit v4.9.5-93-gfe72401d

 > (load "bignum-test")
"/home/lucier/programs/gambit/gambit-lucier/bignum-test.o4"
 > a
1111111111111111111111111111111111111111
 > b
1111111111111111111111111111111111111111
 > (eq? a b)
#t
 > (##bignum? a)
#t

Brad