xref: /dflybsd-src/contrib/gmp/README (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn MarinoCopyright 1991, 1996, 1999, 2000, 2007 Free Software Foundation, Inc.
286d7f5d3SJohn Marino
386d7f5d3SJohn MarinoThis file is part of the GNU MP Library.
486d7f5d3SJohn Marino
586d7f5d3SJohn MarinoThe GNU MP Library is free software; you can redistribute it and/or modify
686d7f5d3SJohn Marinoit under the terms of the GNU Lesser General Public License as published by
786d7f5d3SJohn Marinothe Free Software Foundation; either version 3 of the License, or (at your
886d7f5d3SJohn Marinooption) any later version.
986d7f5d3SJohn Marino
1086d7f5d3SJohn MarinoThe GNU MP Library is distributed in the hope that it will be useful, but
1186d7f5d3SJohn MarinoWITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1286d7f5d3SJohn Marinoor FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
1386d7f5d3SJohn MarinoLicense for more details.
1486d7f5d3SJohn Marino
1586d7f5d3SJohn MarinoYou should have received a copy of the GNU Lesser General Public License
1686d7f5d3SJohn Marinoalong with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
1786d7f5d3SJohn Marino
1886d7f5d3SJohn Marino
1986d7f5d3SJohn Marino
2086d7f5d3SJohn Marino
2186d7f5d3SJohn Marino
2286d7f5d3SJohn Marino
2386d7f5d3SJohn Marino			THE GNU MP LIBRARY
2486d7f5d3SJohn Marino
2586d7f5d3SJohn Marino
2686d7f5d3SJohn MarinoGNU MP is a library for arbitrary precision arithmetic, operating on signed
2786d7f5d3SJohn Marinointegers, rational numbers, and floating point numbers.  It has a rich set of
2886d7f5d3SJohn Marinofunctions, and the functions have a regular interface.
2986d7f5d3SJohn Marino
3086d7f5d3SJohn MarinoGNU MP is designed to be as fast as possible, both for small operands and huge
3186d7f5d3SJohn Marinooperands.  The speed is achieved by using fullwords as the basic arithmetic
3286d7f5d3SJohn Marinotype, by using fast algorithms, with carefully optimized assembly code for the
3386d7f5d3SJohn Marinomost common inner loops for lots of CPUs, and by a general emphasis on speed
3486d7f5d3SJohn Marino(instead of simplicity or elegance).
3586d7f5d3SJohn Marino
3686d7f5d3SJohn MarinoGNU MP is believed to be faster than any other similar library.  Its advantage
3786d7f5d3SJohn Marinoincreases with operand sizes for certain operations, since GNU MP in many
3886d7f5d3SJohn Marinocases has asymptotically faster algorithms.
3986d7f5d3SJohn Marino
4086d7f5d3SJohn MarinoGNU MP is free software and may be freely copied on the terms contained in the
4186d7f5d3SJohn Marinofiles COPYING.LIB and COPYING (most of GNU MP is under the former, some under
4286d7f5d3SJohn Marinothe latter).
4386d7f5d3SJohn Marino
4486d7f5d3SJohn Marino
4586d7f5d3SJohn Marino
4686d7f5d3SJohn Marino			OVERVIEW OF GNU MP
4786d7f5d3SJohn Marino
4886d7f5d3SJohn MarinoThere are five classes of functions in GNU MP.
4986d7f5d3SJohn Marino
5086d7f5d3SJohn Marino 1. Signed integer arithmetic functions (mpz).  These functions are intended
5186d7f5d3SJohn Marino    to be easy to use, with their regular interface.  The associated type is
5286d7f5d3SJohn Marino    `mpz_t'.
5386d7f5d3SJohn Marino
5486d7f5d3SJohn Marino 2. Rational arithmetic functions (mpq).  For now, just a small set of
5586d7f5d3SJohn Marino    functions necessary for basic rational arithmetics.  The associated type
5686d7f5d3SJohn Marino    is `mpq_t'.
5786d7f5d3SJohn Marino
5886d7f5d3SJohn Marino 3. Floating-point arithmetic functions (mpf).  If the C type `double'
5986d7f5d3SJohn Marino    doesn't give enough precision for your application, declare your
6086d7f5d3SJohn Marino    variables as `mpf_t' instead, set the precision to any number desired,
6186d7f5d3SJohn Marino    and call the functions in the mpf class for the arithmetic operations.
6286d7f5d3SJohn Marino
6386d7f5d3SJohn Marino 4. Positive-integer, hard-to-use, very low overhead functions are in the
6486d7f5d3SJohn Marino    mpn class.  No memory management is performed.  The caller must ensure
6586d7f5d3SJohn Marino    enough space is available for the results.  The set of functions is not
6686d7f5d3SJohn Marino    regular, nor is the calling interface.  These functions accept input
6786d7f5d3SJohn Marino    arguments in the form of pairs consisting of a pointer to the least
6886d7f5d3SJohn Marino    significant word, and an integral size telling how many limbs (= words)
6986d7f5d3SJohn Marino    the pointer points to.
7086d7f5d3SJohn Marino
7186d7f5d3SJohn Marino    Almost all calculations, in the entire package, are made by calling these
7286d7f5d3SJohn Marino    low-level functions.
7386d7f5d3SJohn Marino
7486d7f5d3SJohn Marino 5. Berkeley MP compatible functions.
7586d7f5d3SJohn Marino
7686d7f5d3SJohn Marino    To use these functions, include the file "mp.h".  You can test if you are
7786d7f5d3SJohn Marino    using the GNU version by testing if the symbol __GNU_MP__ is defined.
7886d7f5d3SJohn Marino
7986d7f5d3SJohn MarinoFor more information on how to use GNU MP, please refer to the documentation.
8086d7f5d3SJohn MarinoIt is composed from the file doc/gmp.texi, and can be displayed on the screen
8186d7f5d3SJohn Marinoor printed.  How to do that, as well how to build the library, is described in
8286d7f5d3SJohn Marinothe INSTALL file in this directory.
8386d7f5d3SJohn Marino
8486d7f5d3SJohn Marino
8586d7f5d3SJohn Marino
8686d7f5d3SJohn Marino			REPORTING BUGS
8786d7f5d3SJohn Marino
8886d7f5d3SJohn MarinoIf you find a bug in the library, please make sure to tell us about it!
8986d7f5d3SJohn Marino
9086d7f5d3SJohn MarinoYou should first check the GNU MP web pages at http://gmplib.org/, under
9186d7f5d3SJohn Marino"Status of the current release".  There will be patches for all known serious
9286d7f5d3SJohn Marinobugs there.
9386d7f5d3SJohn Marino
9486d7f5d3SJohn MarinoReport bugs to gmp-bugs@gmplib.org.  What information is needed in a useful bug
9586d7f5d3SJohn Marinoreport is described in the manual.  The same address can be used for suggesting
9686d7f5d3SJohn Marinomodifications and enhancements.
9786d7f5d3SJohn Marino
9886d7f5d3SJohn Marino
9986d7f5d3SJohn Marino
10086d7f5d3SJohn Marino
10186d7f5d3SJohn Marino----------------
10286d7f5d3SJohn MarinoLocal variables:
10386d7f5d3SJohn Marinomode: text
10486d7f5d3SJohn Marinofill-column: 78
10586d7f5d3SJohn MarinoEnd:
106