[project @ 1998-11-26 09:17:22 by sof]
[ghc-hetmet.git] / ghc / runtime / gmp / README
1                         THE GNU MP LIBRARY
2
3
4 GNU MP is a library for arbitrary precision arithmetic, operating on
5 signed integers and rational numbers.  It has a rich set of functions,
6 and the functions have a regular interface.
7
8 I have tried to make these functions as fast as possible, both for small
9 operands and for huge operands.  The speed is achieved by using fullwords
10 as the basic arithmetic type, by using fast algorithms, by defining inline
11 assembler for mixed sized multiplication and division (i.e 32*32->64 bit
12 multiplication and 64/32->32,32 bit division), and by hacking the code
13 with emphasis on speed (and not simplicity and elegance).
14
15 The speed of GNU MP is about 5 to 100 times that of Berkeley MP for
16 small operands.  The speed-up increases with the operand sizes for
17 certain operations, for which GNU MP has asymptotically faster algorithms.
18
19
20 There are four classes of functions in GNU MP.
21
22  1. Signed integer arithmetic functions, mpz_*.  The set of functions are
23     intended to be easy to use, being rich and regular.
24
25     To use these functions, include the file "gmp.h".
26
27  2. Rational arithmetic functions, mpq_*.  For now, just a small set of
28     functions necessary for basic rational arithmetics.
29
30     To use these functions, include the file "gmp.h".
31
32  3. Positive-integer, low-level, harder-to-use, but for small operands
33     about twice as fast than the mpz_* functions are the functions in the
34     mpn_* class.  No memory management is performed.  The caller must
35     ensure enough space is available for the results.  The set of
36     functions is not quite regular, nor is the calling interface.  These
37     functions accept input arguments in the form of pairs consisting of a
38     pointer to the least significant word, and a integral size telling how
39     many limbs (= words) the pointer points to.
40
41     Almost all calculations, in the entire package, are made in these
42     low-level functions.
43
44     These functions are not fully documented in this release.  They will
45     probably be so in a future release.
46
47  4. Berkeley MP compatible functions.
48
49     To use these functions, include the file "mp.h".  You can test if you
50     are using the GNU version by testing if the symbol __GNU_MP__ is
51     defined.
52
53
54                         REPORTING BUGS
55
56 If you find a bug in the library, please make sure to tell us about it!
57
58 You can report bugs, and propose modifications and enhancements to
59 tege@gnu.ai.mit.edu.  How to report a bug is further described in
60 the texinfo documentation, see the file gmp.texi.
61