Hi,
out of curiosity, I tried
(alexandria:binomial-coefficient 2000000000000 20)
on a x86 machine (in SBCL between 1.1.18 and master with debug = 3, safety = 3 compiler policy) which resulted in the below session.
Looking at %MULTIPLY-RANGE, I noticed that BISECT-BIG was never called. Calling BISECT-BIG when at least one argument is not a fixnum fixes the problem. The attached patch does that and adds a test case to the test suite.
Kind regards, Jan
CL-USER(5): (alexandria:binomial-coefficient 2000000000000 20)
debugger invoked on a TYPE-ERROR in thread #<THREAD "main thread" RUNNING {B4748E9}>: The value 1999999999981 is not of type (INTEGER 1 536870911).
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name): 0: [ABORT] Exit debugger, returning to top level.
(ALEXANDRIA.0.DEV::%MULTIPLY-RANGE 1999999999981 2000000000000) ; file: /home/jmoringe/code/cl/alexandria/numbers.lisp
source: (BISECT I J) 0] 0
[ applying change in numbers.lisp ]
CL-USER(6): (ql:quickload :alexandria) To load "alexandria": Load 1 ASDF system: alexandria ; Loading "alexandria" [package alexandria.0.dev]................ (:ALEXANDRIA) CL-USER(7): (alexandria:binomial-coefficient 2000000000000 20)
430998041177272843950422879590338454856322722740402365741730748431530623813012487773080486408378680853987520854296499536311275320016878730999689934464711239072435565454954447356845336730100919970769793030177499999999900000000000