summaryrefslogtreecommitdiff
path: root/INSTALL
diff options
context:
space:
mode:
authortege <tege@gmplib.org>2006-04-22 11:23:16 +0200
committertege <tege@gmplib.org>2006-04-22 11:23:16 +0200
commit299d64f4f330c7b87484fc863d58d3126eb1aa31 (patch)
tree80c75740cdfb89992400cf3fbb3a62765702715a /INSTALL
parent5d34a7dadb91f62397d64a78817a37a241174fe2 (diff)
downloadgmp-299d64f4f330c7b87484fc863d58d3126eb1aa31.tar.gz
Rewrite.
Diffstat (limited to 'INSTALL')
-rw-r--r--INSTALL110
1 files changed, 3 insertions, 107 deletions
diff --git a/INSTALL b/INSTALL
index 09dfacb71..572ec63c0 100644
--- a/INSTALL
+++ b/INSTALL
@@ -57,120 +57,16 @@ to write there.
make install
-Next, try some small test programs, for example the ones below.
-
-In GMP programs, all variables need to be initialized before they are
-assigned, and cleared out before program flow leaves the scope in which they
-were declared. Here is an example program that reads two numbers from the
-command line, multiplies them, and prints the result to stdout.
-
-
- #include <stdio.h>
- #include <gmp.h> /* All GMP programs need to include gmp.h */
-
- main (int argc, char **argv)
- {
- mpz_t a, b, p;
-
- if (argc != 3)
- {
- printf ("Usage: %s <number> <number>\n", argv[0]);
- return 1;
- }
-
- /* Initialize variables */
- mpz_init (a);
- mpz_init (b);
- mpz_init (p);
-
- /* Assign a and b from base 10 strings in argv */
- mpz_set_str (a, argv[1], 10);
- mpz_set_str (b, argv[2], 10);
-
- /* Multiply a and b and put the result in p */
- mpz_mul (p, a, b);
-
- /* Print p in decimal */
- gmp_printf ("%Zd\n", p);
-
- /* Clear out variables */
- mpz_clear (a);
- mpz_clear (b);
- mpz_clear (p);
- return 0;
- }
-
-
-This might look tedious, with all the initializing and clearing. Fortunately
-some of these operations can be combined, and other operations can often be
-avoided. An experienced GMP user might write:
-
-
- #include <stdio.h>
- #include <gmp.h>
-
- main (int argc, char **argv)
- {
- mpz_t a, b, p;
-
- if (argc != 3)
- {
- printf ("Usage: %s <number> <number>\n", argv[0]);
- return 1;
- }
-
- /* Initialize and assign a and b from base 10 strings in argv */
- mpz_init_set_str (a, argv[1], 10);
- mpz_init_set_str (b, argv[2], 10);
- /* Initialize p */
- mpz_init (p);
-
- /* Multiply a and b and put the result in p */
- mpz_mul (p, a, b);
-
- /* Print p in decimal */
- gmp_printf ("%Zd\n", p);
-
- /* Since we're about to exit, no need to clear out variables */
- return 0;
- }
-
-
-Now you have to compile your test program, and link it with the GMP library.
-Assuming your working directory is still the gmp build directory, and your
-source file is called example.c, enter:
-
- gcc -g -I. example.c .libs/libgmp.a
-
-After installing, the command becomes: "gcc -g example.c -lgmp". Also, GMP is
-libtool based so you can use that to link if you want.
-
-Now try to run the example:
-
- ./a.out 98365871231256752134 319378318340103345227
- 31415926535897932384618573336104570964418
-
-The functions used here all operate on signed integers, and have names
-starting with "mpz_". There are many more such functions than used in these
-examples. See the chapter "Integer Functions" in the manual for a complete
-list.
-
-There are two other main classes of functions in GMP. They operate on
-rational numbers and floating-point numbers, respectively. The chapters
-"Rational Number Functions", and "Floating-point Functions" document these
-classes.
-
-To run a set of tests, do "make check". This will take a while.
-
To create the printable documentation from the texinfo source, type "make
gmp.dvi" or "make gmp.ps". This requires various "tex" commands.
-If you decide to use GMP, it is a good idea you at least read the chapter "GMP
+If you are new to GMP, it is a good idea you at least read the chapter "GMP
Basics" in the manual.
Some known build problems are noted in the "Installing GMP" chapter of
-the manual. Please report other problems to bug-gmp@gnu.org.
+the manual. Please report other problems to gmp-bugs@swox.com.
+The GMP web site is located here: http://swox.com/gmp/.
----------------