• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..13-Jul-2017-

.dependH A D13-Jul-20171.7 KiB4241

.depend.ntH A D13-Jul-20173 KiB6766

MakefileH A D13-Jul-20171.9 KiB4921

Makefile.ntH A D13-Jul-20171.1 KiB171

READMEH A D13-Jul-20172 KiB5640

arith_flags.mlH A D13-Jul-20171.3 KiB2519

arith_flags.mliH A D13-Jul-20171.3 KiB2119

arith_status.mlH A D13-Jul-20173.7 KiB10187

arith_status.mliH A D13-Jul-20173 KiB6552

big_int.mlH A D13-Jul-201732.1 KiB899811

big_int.mliH A D13-Jul-201710.4 KiB277212

bng.cH A D13-Jul-201711.7 KiB434314

bng.hH A D13-Jul-20175.8 KiB15773

bng_amd64.cH A D13-Jul-20176.5 KiB196161

bng_arm64.cH A D13-Jul-20171.4 KiB235

bng_digit.cH A D13-Jul-20178.2 KiB179122

bng_ia32.cH A D13-Jul-201713.2 KiB412346

bng_ppc.cH A D13-Jul-20175.6 KiB9555

bng_sparc.cH A D13-Jul-20174.7 KiB7853

int_misc.mlH A D13-Jul-20171.6 KiB3728

int_misc.mliH A D13-Jul-20171.3 KiB2623

nat.hH A D13-Jul-20171.2 KiB191

nat.mlH A D13-Jul-201722.3 KiB595543

nat.mliH A D13-Jul-20174.8 KiB9085

nat_stubs.cH A D13-Jul-201712.7 KiB422340

num.mlH A D13-Jul-201714 KiB451363

num.mliH A D13-Jul-20175.5 KiB192138

ratio.mlH A D13-Jul-201721.6 KiB620548

ratio.mliH A D13-Jul-20174 KiB9486

README

1The "libnum" library implements exact-precision arithmetic on
2big integers and on rationals.
3
4This library is derived from Valerie Menissie-Morain's implementation
5of rational arithmetic for Caml V3.1 (INRIA).  Xavier Leroy (INRIA)
6did the Caml Light port.  Victor Manuel Gulias Fernandez did the
7initial Caml Special Light port.  Pierre Weis did most of the
8maintenance and bug fixing.
9
10Initially, the low-level big integer operations were provided by the
11BigNum package developed by Bernard Serpette, Jean Vuillemin and
12Jean-Claude Herve (INRIA and Digital PRL).  License issues forced us to
13replace the BigNum package.  The current implementation of low-level
14big integer operations is due to Xavier Leroy.
15
16This library is documented in "The CAML Numbers Reference Manual" by
17Valerie Menissier-Morain, technical report 141, INRIA, july 1992,
18available at ftp://ftp.inria.fr/INRIA/publication/RT/RT-0141.ps.gz
19
20
21USAGE:
22
23To use the bignum library from your programs, just do
24
25    ocamlc <options> nums.cma <.cmo and .ml files>
26or
27    ocamlopt <options> nums.cmxa <.cmx and .ml files>
28
29for the linking phase.
30
31If you'd like to have the bignum functions available at toplevel, do
32
33    ocamlmktop -o ocamltopnum <options> nums.cma <.cmo and .ml files>
34    ./ocamltopnum
35
36As an example, try:
37
38        open Num;;
39        let rec fact n =
40          if n = 0 then Int 1 else mult_num (num_of_int n) (fact(n-1));;
41        string_of_num(fact 1000);;
42
43
44PROCESSOR-SPECIFIC OPTIMIZATIONS:
45
46When compiled with GCC, the low-level primitives use "inline extended asm"
47to exploit useful features of the target processor (additions and
48subtractions with carry; double-width multiplication, division).
49Here are the processors for which such optimizations are available:
50  IA32 (x86)       (carry, dwmult, dwdiv, 64-bit ops with SSE2 if available)
51  AMD64 (Opteron)  (carry, dwmult, dwdiv)
52  PowerPC          (carry, dwmult)
53  Alpha            (dwmult)
54  SPARC            (carry, dwmult, dwdiv)
55  MIPS             (dwmult)
56