New contrib: SB-GMP
[sbcl.git] / contrib / sb-gmp / README.md
1 SB-GMP
2 ======
3
4 GMP integration for SBCL
5
6 This contrib enables the use of bignum computation routines from the
7 GMP library for SBCL internal bignum calculations.
8
9 Some functions can be transparently replaced within SBCL, namely:
10
11  - sb-bignum:multiply-bignum
12  - sb-bignum:bignum-truncate
13  - sb-bignum:bignum-gcd
14  - sb-kernel::two-arg-lcm
15  - cl:isqrt
16
17 and for making use of the GMP rational arithmetic:
18
19  - sb-kernel::two-arg-+
20  - sb-kernel::two-arg--
21  - sb-kernel::two-arg-*
22  - sb-kernel::two-arg-/
23
24 Most of the other SBCL bignum routines rely on these functions for the
25 heavy computational lifting.
26
27 However, SB-GMP also provides easy and transparent access to several
28 other functions of the GMP library and may be able to replace other
29 parts of the SBCL bignum machinery in the future. Refer to the GMP
30 documentation for the respective function specification.
31
32 The transparent SBCL integration is automatically activated by loading
33 SB-GMP.  Some care is taken to behave correctly across core saves and
34 loads; however, if this does not work correctly, `SB-GMP:UNLOAD-GMP`
35 and `SB-GMP:LOAD-GMP` can be called to explicitly unload and reload
36 libgmp and uninstall/reinstall the hooks.  The hooks can also be
37 directly uninstalled and installed with `SB-GMP:UNINSTALL-GMP-FUNS`
38 and `SB-GMP:INSTALL-GMP-FUNS`.  However, in most cases, binding
39 `SB-GMP:*GMP-DISABLED*` to `T` should suffice.