Arbitrary-precision integers, homed on the Bigint class.
Auto-promotes when integers exceed native range; the generic operators
dispatch bigint operands through the type ops. API: (Bigint + a b), …
bigint-digits-per-limbbigint-basebigintbigint?big-limbsensure-bigbig-addbig-subbig-mulbig-divbig-modbig-ltbig-eq+Add numbers, promoting to bigint on overflow.
Parameters:
INTEGER|BIGINT — Numbers to addReturns: INTEGER|BIGINT — Sum
Examples:
(+ 1 2 3) => 6
(+ 9223372036854775807 1) => 9223372036854775808-Subtract numbers, promoting to bigint on overflow. Unary form negates.
Parameters:
INTEGER|BIGINT — Numbers to subtractReturns: INTEGER|BIGINT — Difference
Examples:
(- 10 3 2) => 5
(- 5) => -5
(- -9223372036854775807 2) => -9223372036854775809*Multiply numbers, promoting to bigint on overflow.
Parameters:
INTEGER|BIGINT — Numbers to multiplyReturns: INTEGER|BIGINT — Product
Examples:
(* 2 3 4) => 24
(* 4294967296 4294967296) => 18446744073709551616/Divide numbers; bigint operands dispatch through the type ops.
Parameters:
INTEGER|BIGINT — Numbers to divideReturns: INTEGER|BIGINT — Quotient
Examples:
(/ 100 5 2) => 10
(/ 18446744073709551616 4294967296) => 4294967296big-digitsbig-sign-stateint-capped-digitsint-capped-baseint-capped-signbigint-typeBigint(Bigint type)The bigint type handle, for Convert and Type.
Returns: ATOM — The BIGINT type handle
(Bigint bigint? x)Test whether a value is an arbitrary-precision integer.
Parameters:
ANY — Value to testReturns: BOOL — True if x is a bigint
(Bigint + a b)Add two bigints (ints promote).
Parameters:
INTEGER|BIGINT — First operandINTEGER|BIGINT — Second operandReturns: INTEGER|BIGINT — Sum, demoted to integer if it fits
(Bigint - a b)Subtract two bigints (ints promote).
Parameters:
INTEGER|BIGINT — First operandINTEGER|BIGINT — Second operandReturns: INTEGER|BIGINT — Difference, demoted to integer if it fits
(Bigint * a b)Multiply two bigints (ints promote).
Parameters:
INTEGER|BIGINT — First operandINTEGER|BIGINT — Second operandReturns: INTEGER|BIGINT — Product, demoted to integer if it fits
(Bigint / a b)Divide two bigints (truncating; ints promote).
Parameters:
INTEGER|BIGINT — DividendINTEGER|BIGINT — DivisorReturns: INTEGER|BIGINT — Quotient, demoted to integer if it fits
(Bigint % a b)Remainder of bigint division (ints promote).
Parameters:
INTEGER|BIGINT — DividendINTEGER|BIGINT — DivisorReturns: INTEGER|BIGINT — Remainder, demoted to integer if it fits
(Bigint < a b)Test whether a is less than b (ints promote).
Parameters:
INTEGER|BIGINT — Left operandINTEGER|BIGINT — Right operandReturns: BOOL — True if a < b
(Bigint = a b)Test whether a equals b (ints promote).
Parameters:
INTEGER|BIGINT — Left operandINTEGER|BIGINT — Right operandReturns: BOOL — True if a equals b
(Bigint would-overflow-add? a b)Test whether addition of two native integers would overflow.
Parameters:
INTEGER — First operandINTEGER — Second operandReturns: BOOL — True if a + b would overflow native integer
(Bigint would-overflow-mul? a b)Test whether multiplication of two native integers would overflow.
Parameters:
INTEGER — First operandINTEGER — Second operandReturns: BOOL — True if a * b would overflow native integer
number?Test whether a value is any numeric type (now including bigints).
Parameters:
ANY — Value to testReturns: BOOL — True if x is a number
Examples:
(number? (* 4294967296 4294967296 4294967296)) => #t