xref: /netbsd-src/external/lgpl3/gmp/dist/doc/gmp.info-2 (revision dd255ccea4286b0c44fa8fd48a9a19a768afe8e1)
1This is ../../gmp/doc/gmp.info, produced by makeinfo version 4.13 from
2../../gmp/doc/gmp.texi.
3
4This manual describes how to install and use the GNU multiple precision
5arithmetic library, version 5.1.3.
6
7   Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
82001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
92013 Free Software Foundation, Inc.
10
11   Permission is granted to copy, distribute and/or modify this
12document under the terms of the GNU Free Documentation License, Version
131.3 or any later version published by the Free Software Foundation;
14with no Invariant Sections, with the Front-Cover Texts being "A GNU
15Manual", and with the Back-Cover Texts being "You have freedom to copy
16and modify this GNU Manual, like GNU software".  A copy of the license
17is included in *note GNU Free Documentation License::.
18
19INFO-DIR-SECTION GNU libraries
20START-INFO-DIR-ENTRY
21* gmp: (gmp).                   GNU Multiple Precision Arithmetic Library.
22END-INFO-DIR-ENTRY
23
24
25File: gmp.info,  Node: Extended GCD,  Next: Jacobi Symbol,  Prev: Subquadratic GCD,  Up: Greatest Common Divisor Algorithms
26
2715.3.4 Extended GCD
28-------------------
29
30The extended GCD function, or GCDEXT, calculates gcd(a,b) and also
31cofactors x and y satisfying a*x+b*y=gcd(a,b). All the algorithms used
32for plain GCD are extended to handle this case. The binary algorithm is
33used only for single-limb GCDEXT.  Lehmer's algorithm is used for sizes
34up to `GCDEXT_DC_THRESHOLD'. Above this threshold, GCDEXT is
35implemented as a loop around HGCD, but with more book-keeping to keep
36track of the cofactors. This gives the same asymptotic running time as
37for GCD and HGCD, O(M(N)*log(N))
38
39   One difference to plain GCD is that while the inputs a and b are
40reduced as the algorithm proceeds, the cofactors x and y grow in size.
41This makes the tuning of the chopping-point more difficult. The current
42code chops off the most significant half of the inputs for the call to
43HGCD in the first iteration, and the most significant two thirds for
44the remaining calls. This strategy could surely be improved. Also the
45stop condition for the loop, where Lehmer's algorithm is invoked once
46the inputs are reduced below `GCDEXT_DC_THRESHOLD', could maybe be
47improved by taking into account the current size of the cofactors.
48
49
50File: gmp.info,  Node: Jacobi Symbol,  Prev: Extended GCD,  Up: Greatest Common Divisor Algorithms
51
5215.3.5 Jacobi Symbol
53--------------------
54
55[This section is obsolete.  The current Jacobi code actually uses a very
56efficient algorithm.]
57
58   `mpz_jacobi' and `mpz_kronecker' are currently implemented with a
59simple binary algorithm similar to that described for the GCDs (*note
60Binary GCD::).  They're not very fast when both inputs are large.
61Lehmer's multi-step improvement or a binary based multi-step algorithm
62is likely to be better.
63
64   When one operand fits a single limb, and that includes
65`mpz_kronecker_ui' and friends, an initial reduction is done with
66either `mpn_mod_1' or `mpn_modexact_1_odd', followed by the binary
67algorithm on a single limb.  The binary algorithm is well suited to a
68single limb, and the whole calculation in this case is quite efficient.
69
70   In all the routines sign changes for the result are accumulated
71using some bit twiddling, avoiding table lookups or conditional jumps.
72
73
74File: gmp.info,  Node: Powering Algorithms,  Next: Root Extraction Algorithms,  Prev: Greatest Common Divisor Algorithms,  Up: Algorithms
75
7615.4 Powering Algorithms
77========================
78
79* Menu:
80
81* Normal Powering Algorithm::
82* Modular Powering Algorithm::
83
84
85File: gmp.info,  Node: Normal Powering Algorithm,  Next: Modular Powering Algorithm,  Prev: Powering Algorithms,  Up: Powering Algorithms
86
8715.4.1 Normal Powering
88----------------------
89
90Normal `mpz' or `mpf' powering uses a simple binary algorithm,
91successively squaring and then multiplying by the base when a 1 bit is
92seen in the exponent, as per Knuth section 4.6.3.  The "left to right"
93variant described there is used rather than algorithm A, since it's
94just as easy and can be done with somewhat less temporary memory.
95
96
97File: gmp.info,  Node: Modular Powering Algorithm,  Prev: Normal Powering Algorithm,  Up: Powering Algorithms
98
9915.4.2 Modular Powering
100-----------------------
101
102Modular powering is implemented using a 2^k-ary sliding window
103algorithm, as per "Handbook of Applied Cryptography" algorithm 14.85
104(*note References::).  k is chosen according to the size of the
105exponent.  Larger exponents use larger values of k, the choice being
106made to minimize the average number of multiplications that must
107supplement the squaring.
108
109   The modular multiplies and squarings use either a simple division or
110the REDC method by Montgomery (*note References::).  REDC is a little
111faster, essentially saving N single limb divisions in a fashion similar
112to an exact remainder (*note Exact Remainder::).
113
114
115File: gmp.info,  Node: Root Extraction Algorithms,  Next: Radix Conversion Algorithms,  Prev: Powering Algorithms,  Up: Algorithms
116
11715.5 Root Extraction Algorithms
118===============================
119
120* Menu:
121
122* Square Root Algorithm::
123* Nth Root Algorithm::
124* Perfect Square Algorithm::
125* Perfect Power Algorithm::
126
127
128File: gmp.info,  Node: Square Root Algorithm,  Next: Nth Root Algorithm,  Prev: Root Extraction Algorithms,  Up: Root Extraction Algorithms
129
13015.5.1 Square Root
131------------------
132
133Square roots are taken using the "Karatsuba Square Root" algorithm by
134Paul Zimmermann (*note References::).
135
136   An input n is split into four parts of k bits each, so with b=2^k we
137have n = a3*b^3 + a2*b^2 + a1*b + a0.  Part a3 must be "normalized" so
138that either the high or second highest bit is set.  In GMP, k is kept
139on a limb boundary and the input is left shifted (by an even number of
140bits) to normalize.
141
142   The square root of the high two parts is taken, by recursive
143application of the algorithm (bottoming out in a one-limb Newton's
144method),
145
146     s1,r1 = sqrtrem (a3*b + a2)
147
148   This is an approximation to the desired root and is extended by a
149division to give s,r,
150
151     q,u = divrem (r1*b + a1, 2*s1)
152     s = s1*b + q
153     r = u*b + a0 - q^2
154
155   The normalization requirement on a3 means at this point s is either
156correct or 1 too big.  r is negative in the latter case, so
157
158     if r < 0 then
159       r = r + 2*s - 1
160       s = s - 1
161
162   The algorithm is expressed in a divide and conquer form, but as
163noted in the paper it can also be viewed as a discrete variant of
164Newton's method, or as a variation on the schoolboy method (no longer
165taught) for square roots two digits at a time.
166
167   If the remainder r is not required then usually only a few high limbs
168of r and u need to be calculated to determine whether an adjustment to
169s is required.  This optimization is not currently implemented.
170
171   In the Karatsuba multiplication range this algorithm is
172O(1.5*M(N/2)), where M(n) is the time to multiply two numbers of n
173limbs.  In the FFT multiplication range this grows to a bound of
174O(6*M(N/2)).  In practice a factor of about 1.5 to 1.8 is found in the
175Karatsuba and Toom-3 ranges, growing to 2 or 3 in the FFT range.
176
177   The algorithm does all its calculations in integers and the resulting
178`mpn_sqrtrem' is used for both `mpz_sqrt' and `mpf_sqrt'.  The extended
179precision given by `mpf_sqrt_ui' is obtained by padding with zero limbs.
180
181
182File: gmp.info,  Node: Nth Root Algorithm,  Next: Perfect Square Algorithm,  Prev: Square Root Algorithm,  Up: Root Extraction Algorithms
183
18415.5.2 Nth Root
185---------------
186
187Integer Nth roots are taken using Newton's method with the following
188iteration, where A is the input and n is the root to be taken.
189
190              1         A
191     a[i+1] = - * ( --------- + (n-1)*a[i] )
192              n     a[i]^(n-1)
193
194   The initial approximation a[1] is generated bitwise by successively
195powering a trial root with or without new 1 bits, aiming to be just
196above the true root.  The iteration converges quadratically when
197started from a good approximation.  When n is large more initial bits
198are needed to get good convergence.  The current implementation is not
199particularly well optimized.
200
201
202File: gmp.info,  Node: Perfect Square Algorithm,  Next: Perfect Power Algorithm,  Prev: Nth Root Algorithm,  Up: Root Extraction Algorithms
203
20415.5.3 Perfect Square
205---------------------
206
207A significant fraction of non-squares can be quickly identified by
208checking whether the input is a quadratic residue modulo small integers.
209
210   `mpz_perfect_square_p' first tests the input mod 256, which means
211just examining the low byte.  Only 44 different values occur for
212squares mod 256, so 82.8% of inputs can be immediately identified as
213non-squares.
214
215   On a 32-bit system similar tests are done mod 9, 5, 7, 13 and 17,
216for a total 99.25% of inputs identified as non-squares.  On a 64-bit
217system 97 is tested too, for a total 99.62%.
218
219   These moduli are chosen because they're factors of 2^24-1 (or 2^48-1
220for 64-bits), and such a remainder can be quickly taken just using
221additions (see `mpn_mod_34lsub1').
222
223   When nails are in use moduli are instead selected by the `gen-psqr.c'
224program and applied with an `mpn_mod_1'.  The same 2^24-1 or 2^48-1
225could be done with nails using some extra bit shifts, but this is not
226currently implemented.
227
228   In any case each modulus is applied to the `mpn_mod_34lsub1' or
229`mpn_mod_1' remainder and a table lookup identifies non-squares.  By
230using a "modexact" style calculation, and suitably permuted tables,
231just one multiply each is required, see the code for details.  Moduli
232are also combined to save operations, so long as the lookup tables
233don't become too big.  `gen-psqr.c' does all the pre-calculations.
234
235   A square root must still be taken for any value that passes these
236tests, to verify it's really a square and not one of the small fraction
237of non-squares that get through (i.e. a pseudo-square to all the tested
238bases).
239
240   Clearly more residue tests could be done, `mpz_perfect_square_p' only
241uses a compact and efficient set.  Big inputs would probably benefit
242from more residue testing, small inputs might be better off with less.
243The assumed distribution of squares versus non-squares in the input
244would affect such considerations.
245
246
247File: gmp.info,  Node: Perfect Power Algorithm,  Prev: Perfect Square Algorithm,  Up: Root Extraction Algorithms
248
24915.5.4 Perfect Power
250--------------------
251
252Detecting perfect powers is required by some factorization algorithms.
253Currently `mpz_perfect_power_p' is implemented using repeated Nth root
254extractions, though naturally only prime roots need to be considered.
255(*Note Nth Root Algorithm::.)
256
257   If a prime divisor p with multiplicity e can be found, then only
258roots which are divisors of e need to be considered, much reducing the
259work necessary.  To this end divisibility by a set of small primes is
260checked.
261
262
263File: gmp.info,  Node: Radix Conversion Algorithms,  Next: Other Algorithms,  Prev: Root Extraction Algorithms,  Up: Algorithms
264
26515.6 Radix Conversion
266=====================
267
268Radix conversions are less important than other algorithms.  A program
269dominated by conversions should probably use a different data
270representation.
271
272* Menu:
273
274* Binary to Radix::
275* Radix to Binary::
276
277
278File: gmp.info,  Node: Binary to Radix,  Next: Radix to Binary,  Prev: Radix Conversion Algorithms,  Up: Radix Conversion Algorithms
279
28015.6.1 Binary to Radix
281----------------------
282
283Conversions from binary to a power-of-2 radix use a simple and fast
284O(N) bit extraction algorithm.
285
286   Conversions from binary to other radices use one of two algorithms.
287Sizes below `GET_STR_PRECOMPUTE_THRESHOLD' use a basic O(N^2) method.
288Repeated divisions by b^n are made, where b is the radix and n is the
289biggest power that fits in a limb.  But instead of simply using the
290remainder r from such divisions, an extra divide step is done to give a
291fractional limb representing r/b^n.  The digits of r can then be
292extracted using multiplications by b rather than divisions.  Special
293case code is provided for decimal, allowing multiplications by 10 to
294optimize to shifts and adds.
295
296   Above `GET_STR_PRECOMPUTE_THRESHOLD' a sub-quadratic algorithm is
297used.  For an input t, powers b^(n*2^i) of the radix are calculated,
298until a power between t and sqrt(t) is reached.  t is then divided by
299that largest power, giving a quotient which is the digits above that
300power, and a remainder which is those below.  These two parts are in
301turn divided by the second highest power, and so on recursively.  When
302a piece has been divided down to less than `GET_STR_DC_THRESHOLD'
303limbs, the basecase algorithm described above is used.
304
305   The advantage of this algorithm is that big divisions can make use
306of the sub-quadratic divide and conquer division (*note Divide and
307Conquer Division::), and big divisions tend to have less overheads than
308lots of separate single limb divisions anyway.  But in any case the
309cost of calculating the powers b^(n*2^i) must first be overcome.
310
311   `GET_STR_PRECOMPUTE_THRESHOLD' and `GET_STR_DC_THRESHOLD' represent
312the same basic thing, the point where it becomes worth doing a big
313division to cut the input in half.  `GET_STR_PRECOMPUTE_THRESHOLD'
314includes the cost of calculating the radix power required, whereas
315`GET_STR_DC_THRESHOLD' assumes that's already available, which is the
316case when recursing.
317
318   Since the base case produces digits from least to most significant
319but they want to be stored from most to least, it's necessary to
320calculate in advance how many digits there will be, or at least be sure
321not to underestimate that.  For GMP the number of input bits is
322multiplied by `chars_per_bit_exactly' from `mp_bases', rounding up.
323The result is either correct or one too big.
324
325   Examining some of the high bits of the input could increase the
326chance of getting the exact number of digits, but an exact result every
327time would not be practical, since in general the difference between
328numbers 100... and 99... is only in the last few bits and the work to
329identify 99...  might well be almost as much as a full conversion.
330
331   `mpf_get_str' doesn't currently use the algorithm described here, it
332multiplies or divides by a power of b to move the radix point to the
333just above the highest non-zero digit (or at worst one above that
334location), then multiplies by b^n to bring out digits.  This is O(N^2)
335and is certainly not optimal.
336
337   The r/b^n scheme described above for using multiplications to bring
338out digits might be useful for more than a single limb.  Some brief
339experiments with it on the base case when recursing didn't give a
340noticeable improvement, but perhaps that was only due to the
341implementation.  Something similar would work for the sub-quadratic
342divisions too, though there would be the cost of calculating a bigger
343radix power.
344
345   Another possible improvement for the sub-quadratic part would be to
346arrange for radix powers that balanced the sizes of quotient and
347remainder produced, i.e. the highest power would be an b^(n*k)
348approximately equal to sqrt(t), not restricted to a 2^i factor.  That
349ought to smooth out a graph of times against sizes, but may or may not
350be a net speedup.
351
352
353File: gmp.info,  Node: Radix to Binary,  Prev: Binary to Radix,  Up: Radix Conversion Algorithms
354
35515.6.2 Radix to Binary
356----------------------
357
358*This section needs to be rewritten, it currently describes the
359algorithms used before GMP 4.3.*
360
361   Conversions from a power-of-2 radix into binary use a simple and fast
362O(N) bitwise concatenation algorithm.
363
364   Conversions from other radices use one of two algorithms.  Sizes
365below `SET_STR_PRECOMPUTE_THRESHOLD' use a basic O(N^2) method.  Groups
366of n digits are converted to limbs, where n is the biggest power of the
367base b which will fit in a limb, then those groups are accumulated into
368the result by multiplying by b^n and adding.  This saves
369multi-precision operations, as per Knuth section 4.4 part E (*note
370References::).  Some special case code is provided for decimal, giving
371the compiler a chance to optimize multiplications by 10.
372
373   Above `SET_STR_PRECOMPUTE_THRESHOLD' a sub-quadratic algorithm is
374used.  First groups of n digits are converted into limbs.  Then adjacent
375limbs are combined into limb pairs with x*b^n+y, where x and y are the
376limbs.  Adjacent limb pairs are combined into quads similarly with
377x*b^(2n)+y.  This continues until a single block remains, that being
378the result.
379
380   The advantage of this method is that the multiplications for each x
381are big blocks, allowing Karatsuba and higher algorithms to be used.
382But the cost of calculating the powers b^(n*2^i) must be overcome.
383`SET_STR_PRECOMPUTE_THRESHOLD' usually ends up quite big, around 5000
384digits, and on some processors much bigger still.
385
386   `SET_STR_PRECOMPUTE_THRESHOLD' is based on the input digits (and
387tuned for decimal), though it might be better based on a limb count, so
388as to be independent of the base.  But that sort of count isn't used by
389the base case and so would need some sort of initial calculation or
390estimate.
391
392   The main reason `SET_STR_PRECOMPUTE_THRESHOLD' is so much bigger
393than the corresponding `GET_STR_PRECOMPUTE_THRESHOLD' is that
394`mpn_mul_1' is much faster than `mpn_divrem_1' (often by a factor of 5,
395or more).
396
397
398File: gmp.info,  Node: Other Algorithms,  Next: Assembly Coding,  Prev: Radix Conversion Algorithms,  Up: Algorithms
399
40015.7 Other Algorithms
401=====================
402
403* Menu:
404
405* Prime Testing Algorithm::
406* Factorial Algorithm::
407* Binomial Coefficients Algorithm::
408* Fibonacci Numbers Algorithm::
409* Lucas Numbers Algorithm::
410* Random Number Algorithms::
411
412
413File: gmp.info,  Node: Prime Testing Algorithm,  Next: Factorial Algorithm,  Prev: Other Algorithms,  Up: Other Algorithms
414
41515.7.1 Prime Testing
416--------------------
417
418The primality testing in `mpz_probab_prime_p' (*note Number Theoretic
419Functions::) first does some trial division by small factors and then
420uses the Miller-Rabin probabilistic primality testing algorithm, as
421described in Knuth section 4.5.4 algorithm P (*note References::).
422
423   For an odd input n, and with n = q*2^k+1 where q is odd, this
424algorithm selects a random base x and tests whether x^q mod n is 1 or
425-1, or an x^(q*2^j) mod n is 1, for 1<=j<=k.  If so then n is probably
426prime, if not then n is definitely composite.
427
428   Any prime n will pass the test, but some composites do too.  Such
429composites are known as strong pseudoprimes to base x.  No n is a
430strong pseudoprime to more than 1/4 of all bases (see Knuth exercise
43122), hence with x chosen at random there's no more than a 1/4 chance a
432"probable prime" will in fact be composite.
433
434   In fact strong pseudoprimes are quite rare, making the test much more
435powerful than this analysis would suggest, but 1/4 is all that's proven
436for an arbitrary n.
437
438
439File: gmp.info,  Node: Factorial Algorithm,  Next: Binomial Coefficients Algorithm,  Prev: Prime Testing Algorithm,  Up: Other Algorithms
440
44115.7.2 Factorial
442----------------
443
444Factorials are calculated by a combination of two algorithms. An idea is
445shared among them: to compute the odd part of the factorial; a final
446step takes account of the power of 2 term, by shifting.
447
448   For small n, the odd factor of n! is computed with the simple
449observation that it is equal to the product of all positive odd numbers
450smaller than n times the odd factor of [n/2]!, where [x] is the integer
451part of x, and so on recursively. The procedure can be best illustrated
452with an example,
453
454     23! = (23.21.19.17.15.13.11.9.7.5.3)(11.9.7.5.3)(5.3)2^19
455
456   Current code collects all the factors in a single list, with a loop
457and no recursion, and compute the product, with no special care for
458repeated chunks.
459
460   When n is larger, computation pass trough prime sieving. An helper
461function is used, as suggested by Peter Luschny:
462
463                                 n
464                               -----
465                    n!          | |   L(p,n)
466     msf(n) = -------------- =  | |  p
467               [n/2]!^2.2^k     p=3
468
469   Where p ranges on odd prime numbers. The exponent k is chosen to
470obtain an odd integer number: k is the number of 1 bits in the binary
471representation of [n/2]. The function L(p,n) can be defined as zero
472when p is composite, and, for any prime p, it is computed with:
473
474               ---
475                \    n
476     L(p,n) =   /  [---] mod 2   <=  log (n) .
477               ---  p^i                p
478               i>0
479
480   With this helper function, we are able to compute the odd part of n!
481using the recursion implied by n!=[n/2]!^2*msf(n)*2^k. The recursion
482stops using the small-n algorithm on some [n/2^i].
483
484   Both the above algorithms use binary splitting to compute the
485product of many small factors. At first as many products as possible
486are accumulated in a single register, generating a list of factors that
487fit in a machine word. This list is then split into halves, and the
488product is computed recursively.
489
490   Such splitting is more efficient than repeated Nx1 multiplies since
491it forms big multiplies, allowing Karatsuba and higher algorithms to be
492used.  And even below the Karatsuba threshold a big block of work can
493be more efficient for the basecase algorithm.
494
495
496File: gmp.info,  Node: Binomial Coefficients Algorithm,  Next: Fibonacci Numbers Algorithm,  Prev: Factorial Algorithm,  Up: Other Algorithms
497
49815.7.3 Binomial Coefficients
499----------------------------
500
501Binomial coefficients C(n,k) are calculated by first arranging k <= n/2
502using C(n,k) = C(n,n-k) if necessary, and then evaluating the following
503product simply from i=2 to i=k.
504
505                           k  (n-k+i)
506     C(n,k) =  (n-k+1) * prod -------
507                          i=2    i
508
509   It's easy to show that each denominator i will divide the product so
510far, so the exact division algorithm is used (*note Exact Division::).
511
512   The numerators n-k+i and denominators i are first accumulated into
513as many fit a limb, to save multi-precision operations, though for
514`mpz_bin_ui' this applies only to the divisors, since n is an `mpz_t'
515and n-k+i in general won't fit in a limb at all.
516
517
518File: gmp.info,  Node: Fibonacci Numbers Algorithm,  Next: Lucas Numbers Algorithm,  Prev: Binomial Coefficients Algorithm,  Up: Other Algorithms
519
52015.7.4 Fibonacci Numbers
521------------------------
522
523The Fibonacci functions `mpz_fib_ui' and `mpz_fib2_ui' are designed for
524calculating isolated F[n] or F[n],F[n-1] values efficiently.
525
526   For small n, a table of single limb values in `__gmp_fib_table' is
527used.  On a 32-bit limb this goes up to F[47], or on a 64-bit limb up
528to F[93].  For convenience the table starts at F[-1].
529
530   Beyond the table, values are generated with a binary powering
531algorithm, calculating a pair F[n] and F[n-1] working from high to low
532across the bits of n.  The formulas used are
533
534     F[2k+1] = 4*F[k]^2 - F[k-1]^2 + 2*(-1)^k
535     F[2k-1] =   F[k]^2 + F[k-1]^2
536
537     F[2k] = F[2k+1] - F[2k-1]
538
539   At each step, k is the high b bits of n.  If the next bit of n is 0
540then F[2k],F[2k-1] is used, or if it's a 1 then F[2k+1],F[2k] is used,
541and the process repeated until all bits of n are incorporated.  Notice
542these formulas require just two squares per bit of n.
543
544   It'd be possible to handle the first few n above the single limb
545table with simple additions, using the defining Fibonacci recurrence
546F[k+1]=F[k]+F[k-1], but this is not done since it usually turns out to
547be faster for only about 10 or 20 values of n, and including a block of
548code for just those doesn't seem worthwhile.  If they really mattered
549it'd be better to extend the data table.
550
551   Using a table avoids lots of calculations on small numbers, and
552makes small n go fast.  A bigger table would make more small n go fast,
553it's just a question of balancing size against desired speed.  For GMP
554the code is kept compact, with the emphasis primarily on a good
555powering algorithm.
556
557   `mpz_fib2_ui' returns both F[n] and F[n-1], but `mpz_fib_ui' is only
558interested in F[n].  In this case the last step of the algorithm can
559become one multiply instead of two squares.  One of the following two
560formulas is used, according as n is odd or even.
561
562     F[2k]   = F[k]*(F[k]+2F[k-1])
563
564     F[2k+1] = (2F[k]+F[k-1])*(2F[k]-F[k-1]) + 2*(-1)^k
565
566   F[2k+1] here is the same as above, just rearranged to be a multiply.
567For interest, the 2*(-1)^k term both here and above can be applied just
568to the low limb of the calculation, without a carry or borrow into
569further limbs, which saves some code size.  See comments with
570`mpz_fib_ui' and the internal `mpn_fib2_ui' for how this is done.
571
572
573File: gmp.info,  Node: Lucas Numbers Algorithm,  Next: Random Number Algorithms,  Prev: Fibonacci Numbers Algorithm,  Up: Other Algorithms
574
57515.7.5 Lucas Numbers
576--------------------
577
578`mpz_lucnum2_ui' derives a pair of Lucas numbers from a pair of
579Fibonacci numbers with the following simple formulas.
580
581     L[k]   =   F[k] + 2*F[k-1]
582     L[k-1] = 2*F[k] -   F[k-1]
583
584   `mpz_lucnum_ui' is only interested in L[n], and some work can be
585saved.  Trailing zero bits on n can be handled with a single square
586each.
587
588     L[2k] = L[k]^2 - 2*(-1)^k
589
590   And the lowest 1 bit can be handled with one multiply of a pair of
591Fibonacci numbers, similar to what `mpz_fib_ui' does.
592
593     L[2k+1] = 5*F[k-1]*(2*F[k]+F[k-1]) - 4*(-1)^k
594
595
596File: gmp.info,  Node: Random Number Algorithms,  Prev: Lucas Numbers Algorithm,  Up: Other Algorithms
597
59815.7.6 Random Numbers
599---------------------
600
601For the `urandomb' functions, random numbers are generated simply by
602concatenating bits produced by the generator.  As long as the generator
603has good randomness properties this will produce well-distributed N bit
604numbers.
605
606   For the `urandomm' functions, random numbers in a range 0<=R<N are
607generated by taking values R of ceil(log2(N)) bits each until one
608satisfies R<N.  This will normally require only one or two attempts,
609but the attempts are limited in case the generator is somehow
610degenerate and produces only 1 bits or similar.
611
612   The Mersenne Twister generator is by Matsumoto and Nishimura (*note
613References::).  It has a non-repeating period of 2^19937-1, which is a
614Mersenne prime, hence the name of the generator.  The state is 624
615words of 32-bits each, which is iterated with one XOR and shift for each
61632-bit word generated, making the algorithm very fast.  Randomness
617properties are also very good and this is the default algorithm used by
618GMP.
619
620   Linear congruential generators are described in many text books, for
621instance Knuth volume 2 (*note References::).  With a modulus M and
622parameters A and C, an integer state S is iterated by the formula S <-
623A*S+C mod M.  At each step the new state is a linear function of the
624previous, mod M, hence the name of the generator.
625
626   In GMP only moduli of the form 2^N are supported, and the current
627implementation is not as well optimized as it could be.  Overheads are
628significant when N is small, and when N is large clearly the multiply
629at each step will become slow.  This is not a big concern, since the
630Mersenne Twister generator is better in every respect and is therefore
631recommended for all normal applications.
632
633   For both generators the current state can be deduced by observing
634enough output and applying some linear algebra (over GF(2) in the case
635of the Mersenne Twister).  This generally means raw output is
636unsuitable for cryptographic applications without further hashing or
637the like.
638
639
640File: gmp.info,  Node: Assembly Coding,  Prev: Other Algorithms,  Up: Algorithms
641
64215.8 Assembly Coding
643====================
644
645The assembly subroutines in GMP are the most significant source of
646speed at small to moderate sizes.  At larger sizes algorithm selection
647becomes more important, but of course speedups in low level routines
648will still speed up everything proportionally.
649
650   Carry handling and widening multiplies that are important for GMP
651can't be easily expressed in C.  GCC `asm' blocks help a lot and are
652provided in `longlong.h', but hand coding low level routines invariably
653offers a speedup over generic C by a factor of anything from 2 to 10.
654
655* Menu:
656
657* Assembly Code Organisation::
658* Assembly Basics::
659* Assembly Carry Propagation::
660* Assembly Cache Handling::
661* Assembly Functional Units::
662* Assembly Floating Point::
663* Assembly SIMD Instructions::
664* Assembly Software Pipelining::
665* Assembly Loop Unrolling::
666* Assembly Writing Guide::
667
668
669File: gmp.info,  Node: Assembly Code Organisation,  Next: Assembly Basics,  Prev: Assembly Coding,  Up: Assembly Coding
670
67115.8.1 Code Organisation
672------------------------
673
674The various `mpn' subdirectories contain machine-dependent code, written
675in C or assembly.  The `mpn/generic' subdirectory contains default code,
676used when there's no machine-specific version of a particular file.
677
678   Each `mpn' subdirectory is for an ISA family.  Generally 32-bit and
67964-bit variants in a family cannot share code and have separate
680directories.  Within a family further subdirectories may exist for CPU
681variants.
682
683   In each directory a `nails' subdirectory may exist, holding code with
684nails support for that CPU variant.  A `NAILS_SUPPORT' directive in each
685file indicates the nails values the code handles.  Nails code only
686exists where it's faster, or promises to be faster, than plain code.
687There's no effort put into nails if they're not going to enhance a
688given CPU.
689
690
691File: gmp.info,  Node: Assembly Basics,  Next: Assembly Carry Propagation,  Prev: Assembly Code Organisation,  Up: Assembly Coding
692
69315.8.2 Assembly Basics
694----------------------
695
696`mpn_addmul_1' and `mpn_submul_1' are the most important routines for
697overall GMP performance.  All multiplications and divisions come down to
698repeated calls to these.  `mpn_add_n', `mpn_sub_n', `mpn_lshift' and
699`mpn_rshift' are next most important.
700
701   On some CPUs assembly versions of the internal functions
702`mpn_mul_basecase' and `mpn_sqr_basecase' give significant speedups,
703mainly through avoiding function call overheads.  They can also
704potentially make better use of a wide superscalar processor, as can
705bigger primitives like `mpn_addmul_2' or `mpn_addmul_4'.
706
707   The restrictions on overlaps between sources and destinations (*note
708Low-level Functions::) are designed to facilitate a variety of
709implementations.  For example, knowing `mpn_add_n' won't have partly
710overlapping sources and destination means reading can be done far ahead
711of writing on superscalar processors, and loops can be vectorized on a
712vector processor, depending on the carry handling.
713
714
715File: gmp.info,  Node: Assembly Carry Propagation,  Next: Assembly Cache Handling,  Prev: Assembly Basics,  Up: Assembly Coding
716
71715.8.3 Carry Propagation
718------------------------
719
720The problem that presents most challenges in GMP is propagating carries
721from one limb to the next.  In functions like `mpn_addmul_1' and
722`mpn_add_n', carries are the only dependencies between limb operations.
723
724   On processors with carry flags, a straightforward CISC style `adc' is
725generally best.  AMD K6 `mpn_addmul_1' however is an example of an
726unusual set of circumstances where a branch works out better.
727
728   On RISC processors generally an add and compare for overflow is
729used.  This sort of thing can be seen in `mpn/generic/aors_n.c'.  Some
730carry propagation schemes require 4 instructions, meaning at least 4
731cycles per limb, but other schemes may use just 1 or 2.  On wide
732superscalar processors performance may be completely determined by the
733number of dependent instructions between carry-in and carry-out for
734each limb.
735
736   On vector processors good use can be made of the fact that a carry
737bit only very rarely propagates more than one limb.  When adding a
738single bit to a limb, there's only a carry out if that limb was
739`0xFF...FF' which on random data will be only 1 in 2^mp_bits_per_limb.
740`mpn/cray/add_n.c' is an example of this, it adds all limbs in
741parallel, adds one set of carry bits in parallel and then only rarely
742needs to fall through to a loop propagating further carries.
743
744   On the x86s, GCC (as of version 2.95.2) doesn't generate
745particularly good code for the RISC style idioms that are necessary to
746handle carry bits in C.  Often conditional jumps are generated where
747`adc' or `sbb' forms would be better.  And so unfortunately almost any
748loop involving carry bits needs to be coded in assembly for best
749results.
750
751
752File: gmp.info,  Node: Assembly Cache Handling,  Next: Assembly Functional Units,  Prev: Assembly Carry Propagation,  Up: Assembly Coding
753
75415.8.4 Cache Handling
755---------------------
756
757GMP aims to perform well both on operands that fit entirely in L1 cache
758and those which don't.
759
760   Basic routines like `mpn_add_n' or `mpn_lshift' are often used on
761large operands, so L2 and main memory performance is important for them.
762`mpn_mul_1' and `mpn_addmul_1' are mostly used for multiply and square
763basecases, so L1 performance matters most for them, unless assembly
764versions of `mpn_mul_basecase' and `mpn_sqr_basecase' exist, in which
765case the remaining uses are mostly for larger operands.
766
767   For L2 or main memory operands, memory access times will almost
768certainly be more than the calculation time.  The aim therefore is to
769maximize memory throughput, by starting a load of the next cache line
770while processing the contents of the previous one.  Clearly this is
771only possible if the chip has a lock-up free cache or some sort of
772prefetch instruction.  Most current chips have both these features.
773
774   Prefetching sources combines well with loop unrolling, since a
775prefetch can be initiated once per unrolled loop (or more than once if
776the loop covers more than one cache line).
777
778   On CPUs without write-allocate caches, prefetching destinations will
779ensure individual stores don't go further down the cache hierarchy,
780limiting bandwidth.  Of course for calculations which are slow anyway,
781like `mpn_divrem_1', write-throughs might be fine.
782
783   The distance ahead to prefetch will be determined by memory latency
784versus throughput.  The aim of course is to have data arriving
785continuously, at peak throughput.  Some CPUs have limits on the number
786of fetches or prefetches in progress.
787
788   If a special prefetch instruction doesn't exist then a plain load
789can be used, but in that case care must be taken not to attempt to read
790past the end of an operand, since that might produce a segmentation
791violation.
792
793   Some CPUs or systems have hardware that detects sequential memory
794accesses and initiates suitable cache movements automatically, making
795life easy.
796
797
798File: gmp.info,  Node: Assembly Functional Units,  Next: Assembly Floating Point,  Prev: Assembly Cache Handling,  Up: Assembly Coding
799
80015.8.5 Functional Units
801-----------------------
802
803When choosing an approach for an assembly loop, consideration is given
804to what operations can execute simultaneously and what throughput can
805thereby be achieved.  In some cases an algorithm can be tweaked to
806accommodate available resources.
807
808   Loop control will generally require a counter and pointer updates,
809costing as much as 5 instructions, plus any delays a branch introduces.
810CPU addressing modes might reduce pointer updates, perhaps by allowing
811just one updating pointer and others expressed as offsets from it, or
812on CISC chips with all addressing done with the loop counter as a
813scaled index.
814
815   The final loop control cost can be amortised by processing several
816limbs in each iteration (*note Assembly Loop Unrolling::).  This at
817least ensures loop control isn't a big fraction the work done.
818
819   Memory throughput is always a limit.  If perhaps only one load or
820one store can be done per cycle then 3 cycles/limb will the top speed
821for "binary" operations like `mpn_add_n', and any code achieving that
822is optimal.
823
824   Integer resources can be freed up by having the loop counter in a
825float register, or by pressing the float units into use for some
826multiplying, perhaps doing every second limb on the float side (*note
827Assembly Floating Point::).
828
829   Float resources can be freed up by doing carry propagation on the
830integer side, or even by doing integer to float conversions in integers
831using bit twiddling.
832
833
834File: gmp.info,  Node: Assembly Floating Point,  Next: Assembly SIMD Instructions,  Prev: Assembly Functional Units,  Up: Assembly Coding
835
83615.8.6 Floating Point
837---------------------
838
839Floating point arithmetic is used in GMP for multiplications on CPUs
840with poor integer multipliers.  It's mostly useful for `mpn_mul_1',
841`mpn_addmul_1' and `mpn_submul_1' on 64-bit machines, and
842`mpn_mul_basecase' on both 32-bit and 64-bit machines.
843
844   With IEEE 53-bit double precision floats, integer multiplications
845producing up to 53 bits will give exact results.  Breaking a 64x64
846multiplication into eight 16x32->48 bit pieces is convenient.  With
847some care though six 21x32->53 bit products can be used, if one of the
848lower two 21-bit pieces also uses the sign bit.
849
850   For the `mpn_mul_1' family of functions on a 64-bit machine, the
851invariant single limb is split at the start, into 3 or 4 pieces.
852Inside the loop, the bignum operand is split into 32-bit pieces.  Fast
853conversion of these unsigned 32-bit pieces to floating point is highly
854machine-dependent.  In some cases, reading the data into the integer
855unit, zero-extending to 64-bits, then transferring to the floating
856point unit back via memory is the only option.
857
858   Converting partial products back to 64-bit limbs is usually best
859done as a signed conversion.  Since all values are smaller than 2^53,
860signed and unsigned are the same, but most processors lack unsigned
861conversions.
862
863
864
865   Here is a diagram showing 16x32 bit products for an `mpn_mul_1' or
866`mpn_addmul_1' with a 64-bit limb.  The single limb operand V is split
867into four 16-bit parts.  The multi-limb operand U is split in the loop
868into two 32-bit parts.
869
870                     +---+---+---+---+
871                     |v48|v32|v16|v00|    V operand
872                     +---+---+---+---+
873
874                     +-------+---+---+
875                 x   |  u32  |  u00  |    U operand (one limb)
876                     +---------------+
877
878     ---------------------------------
879
880                         +-----------+
881                         | u00 x v00 |    p00    48-bit products
882                         +-----------+
883                     +-----------+
884                     | u00 x v16 |        p16
885                     +-----------+
886                 +-----------+
887                 | u00 x v32 |            p32
888                 +-----------+
889             +-----------+
890             | u00 x v48 |                p48
891             +-----------+
892                 +-----------+
893                 | u32 x v00 |            r32
894                 +-----------+
895             +-----------+
896             | u32 x v16 |                r48
897             +-----------+
898         +-----------+
899         | u32 x v32 |                    r64
900         +-----------+
901     +-----------+
902     | u32 x v48 |                        r80
903     +-----------+
904
905   p32 and r32 can be summed using floating-point addition, and
906likewise p48 and r48.  p00 and p16 can be summed with r64 and r80 from
907the previous iteration.
908
909   For each loop then, four 49-bit quantities are transferred to the
910integer unit, aligned as follows,
911
912     |-----64bits----|-----64bits----|
913                        +------------+
914                        | p00 + r64' |    i00
915                        +------------+
916                    +------------+
917                    | p16 + r80' |        i16
918                    +------------+
919                +------------+
920                | p32 + r32  |            i32
921                +------------+
922            +------------+
923            | p48 + r48  |                i48
924            +------------+
925
926   The challenge then is to sum these efficiently and add in a carry
927limb, generating a low 64-bit result limb and a high 33-bit carry limb
928(i48 extends 33 bits into the high half).
929
930
931File: gmp.info,  Node: Assembly SIMD Instructions,  Next: Assembly Software Pipelining,  Prev: Assembly Floating Point,  Up: Assembly Coding
932
93315.8.7 SIMD Instructions
934------------------------
935
936The single-instruction multiple-data support in current microprocessors
937is aimed at signal processing algorithms where each data point can be
938treated more or less independently.  There's generally not much support
939for propagating the sort of carries that arise in GMP.
940
941   SIMD multiplications of say four 16x16 bit multiplies only do as much
942work as one 32x32 from GMP's point of view, and need some shifts and
943adds besides.  But of course if say the SIMD form is fully pipelined
944and uses less instruction decoding then it may still be worthwhile.
945
946   On the x86 chips, MMX has so far found a use in `mpn_rshift' and
947`mpn_lshift', and is used in a special case for 16-bit multipliers in
948the P55 `mpn_mul_1'.  SSE2 is used for Pentium 4 `mpn_mul_1',
949`mpn_addmul_1', and `mpn_submul_1'.
950
951
952File: gmp.info,  Node: Assembly Software Pipelining,  Next: Assembly Loop Unrolling,  Prev: Assembly SIMD Instructions,  Up: Assembly Coding
953
95415.8.8 Software Pipelining
955--------------------------
956
957Software pipelining consists of scheduling instructions around the
958branch point in a loop.  For example a loop might issue a load not for
959use in the present iteration but the next, thereby allowing extra
960cycles for the data to arrive from memory.
961
962   Naturally this is wanted only when doing things like loads or
963multiplies that take several cycles to complete, and only where a CPU
964has multiple functional units so that other work can be done in the
965meantime.
966
967   A pipeline with several stages will have a data value in progress at
968each stage and each loop iteration moves them along one stage.  This is
969like juggling.
970
971   If the latency of some instruction is greater than the loop time
972then it will be necessary to unroll, so one register has a result ready
973to use while another (or multiple others) are still in progress.
974(*note Assembly Loop Unrolling::).
975
976
977File: gmp.info,  Node: Assembly Loop Unrolling,  Next: Assembly Writing Guide,  Prev: Assembly Software Pipelining,  Up: Assembly Coding
978
97915.8.9 Loop Unrolling
980---------------------
981
982Loop unrolling consists of replicating code so that several limbs are
983processed in each loop.  At a minimum this reduces loop overheads by a
984corresponding factor, but it can also allow better register usage, for
985example alternately using one register combination and then another.
986Judicious use of `m4' macros can help avoid lots of duplication in the
987source code.
988
989   Any amount of unrolling can be handled with a loop counter that's
990decremented by N each time, stopping when the remaining count is less
991than the further N the loop will process.  Or by subtracting N at the
992start, the termination condition becomes when the counter C is less
993than 0 (and the count of remaining limbs is C+N).
994
995   Alternately for a power of 2 unroll the loop count and remainder can
996be established with a shift and mask.  This is convenient if also
997making a computed jump into the middle of a large loop.
998
999   The limbs not a multiple of the unrolling can be handled in various
1000ways, for example
1001
1002   * A simple loop at the end (or the start) to process the excess.
1003     Care will be wanted that it isn't too much slower than the
1004     unrolled part.
1005
1006   * A set of binary tests, for example after an 8-limb unrolling, test
1007     for 4 more limbs to process, then a further 2 more or not, and
1008     finally 1 more or not.  This will probably take more code space
1009     than a simple loop.
1010
1011   * A `switch' statement, providing separate code for each possible
1012     excess, for example an 8-limb unrolling would have separate code
1013     for 0 remaining, 1 remaining, etc, up to 7 remaining.  This might
1014     take a lot of code, but may be the best way to optimize all cases
1015     in combination with a deep pipelined loop.
1016
1017   * A computed jump into the middle of the loop, thus making the first
1018     iteration handle the excess.  This should make times smoothly
1019     increase with size, which is attractive, but setups for the jump
1020     and adjustments for pointers can be tricky and could become quite
1021     difficult in combination with deep pipelining.
1022
1023
1024File: gmp.info,  Node: Assembly Writing Guide,  Prev: Assembly Loop Unrolling,  Up: Assembly Coding
1025
102615.8.10 Writing Guide
1027---------------------
1028
1029This is a guide to writing software pipelined loops for processing limb
1030vectors in assembly.
1031
1032   First determine the algorithm and which instructions are needed.
1033Code it without unrolling or scheduling, to make sure it works.  On a
10343-operand CPU try to write each new value to a new register, this will
1035greatly simplify later steps.
1036
1037   Then note for each instruction the functional unit and/or issue port
1038requirements.  If an instruction can use either of two units, like U0
1039or U1 then make a category "U0/U1".  Count the total using each unit
1040(or combined unit), and count all instructions.
1041
1042   Figure out from those counts the best possible loop time.  The goal
1043will be to find a perfect schedule where instruction latencies are
1044completely hidden.  The total instruction count might be the limiting
1045factor, or perhaps a particular functional unit.  It might be possible
1046to tweak the instructions to help the limiting factor.
1047
1048   Suppose the loop time is N, then make N issue buckets, with the
1049final loop branch at the end of the last.  Now fill the buckets with
1050dummy instructions using the functional units desired.  Run this to
1051make sure the intended speed is reached.
1052
1053   Now replace the dummy instructions with the real instructions from
1054the slow but correct loop you started with.  The first will typically
1055be a load instruction.  Then the instruction using that value is placed
1056in a bucket an appropriate distance down.  Run the loop again, to check
1057it still runs at target speed.
1058
1059   Keep placing instructions, frequently measuring the loop.  After a
1060few you will need to wrap around from the last bucket back to the top
1061of the loop.  If you used the new-register for new-value strategy above
1062then there will be no register conflicts.  If not then take care not to
1063clobber something already in use.  Changing registers at this time is
1064very error prone.
1065
1066   The loop will overlap two or more of the original loop iterations,
1067and the computation of one vector element result will be started in one
1068iteration of the new loop, and completed one or several iterations
1069later.
1070
1071   The final step is to create feed-in and wind-down code for the loop.
1072A good way to do this is to make a copy (or copies) of the loop at the
1073start and delete those instructions which don't have valid antecedents,
1074and at the end replicate and delete those whose results are unwanted
1075(including any further loads).
1076
1077   The loop will have a minimum number of limbs loaded and processed,
1078so the feed-in code must test if the request size is smaller and skip
1079either to a suitable part of the wind-down or to special code for small
1080sizes.
1081
1082
1083File: gmp.info,  Node: Internals,  Next: Contributors,  Prev: Algorithms,  Up: Top
1084
108516 Internals
1086************
1087
1088*This chapter is provided only for informational purposes and the
1089various internals described here may change in future GMP releases.
1090Applications expecting to be compatible with future releases should use
1091only the documented interfaces described in previous chapters.*
1092
1093* Menu:
1094
1095* Integer Internals::
1096* Rational Internals::
1097* Float Internals::
1098* Raw Output Internals::
1099* C++ Interface Internals::
1100
1101
1102File: gmp.info,  Node: Integer Internals,  Next: Rational Internals,  Prev: Internals,  Up: Internals
1103
110416.1 Integer Internals
1105======================
1106
1107`mpz_t' variables represent integers using sign and magnitude, in space
1108dynamically allocated and reallocated.  The fields are as follows.
1109
1110`_mp_size'
1111     The number of limbs, or the negative of that when representing a
1112     negative integer.  Zero is represented by `_mp_size' set to zero,
1113     in which case the `_mp_d' data is unused.
1114
1115`_mp_d'
1116     A pointer to an array of limbs which is the magnitude.  These are
1117     stored "little endian" as per the `mpn' functions, so `_mp_d[0]'
1118     is the least significant limb and `_mp_d[ABS(_mp_size)-1]' is the
1119     most significant.  Whenever `_mp_size' is non-zero, the most
1120     significant limb is non-zero.
1121
1122     Currently there's always at least one limb allocated, so for
1123     instance `mpz_set_ui' never needs to reallocate, and `mpz_get_ui'
1124     can fetch `_mp_d[0]' unconditionally (though its value is then
1125     only wanted if `_mp_size' is non-zero).
1126
1127`_mp_alloc'
1128     `_mp_alloc' is the number of limbs currently allocated at `_mp_d',
1129     and naturally `_mp_alloc >= ABS(_mp_size)'.  When an `mpz' routine
1130     is about to (or might be about to) increase `_mp_size', it checks
1131     `_mp_alloc' to see whether there's enough space, and reallocates
1132     if not.  `MPZ_REALLOC' is generally used for this.
1133
1134   The various bitwise logical functions like `mpz_and' behave as if
1135negative values were twos complement.  But sign and magnitude is always
1136used internally, and necessary adjustments are made during the
1137calculations.  Sometimes this isn't pretty, but sign and magnitude are
1138best for other routines.
1139
1140   Some internal temporary variables are setup with `MPZ_TMP_INIT' and
1141these have `_mp_d' space obtained from `TMP_ALLOC' rather than the
1142memory allocation functions.  Care is taken to ensure that these are
1143big enough that no reallocation is necessary (since it would have
1144unpredictable consequences).
1145
1146   `_mp_size' and `_mp_alloc' are `int', although `mp_size_t' is
1147usually a `long'.  This is done to make the fields just 32 bits on some
114864 bits systems, thereby saving a few bytes of data space but still
1149providing plenty of range.
1150
1151
1152File: gmp.info,  Node: Rational Internals,  Next: Float Internals,  Prev: Integer Internals,  Up: Internals
1153
115416.2 Rational Internals
1155=======================
1156
1157`mpq_t' variables represent rationals using an `mpz_t' numerator and
1158denominator (*note Integer Internals::).
1159
1160   The canonical form adopted is denominator positive (and non-zero),
1161no common factors between numerator and denominator, and zero uniquely
1162represented as 0/1.
1163
1164   It's believed that casting out common factors at each stage of a
1165calculation is best in general.  A GCD is an O(N^2) operation so it's
1166better to do a few small ones immediately than to delay and have to do
1167a big one later.  Knowing the numerator and denominator have no common
1168factors can be used for example in `mpq_mul' to make only two cross
1169GCDs necessary, not four.
1170
1171   This general approach to common factors is badly sub-optimal in the
1172presence of simple factorizations or little prospect for cancellation,
1173but GMP has no way to know when this will occur.  As per *note
1174Efficiency::, that's left to applications.  The `mpq_t' framework might
1175still suit, with `mpq_numref' and `mpq_denref' for direct access to the
1176numerator and denominator, or of course `mpz_t' variables can be used
1177directly.
1178
1179
1180File: gmp.info,  Node: Float Internals,  Next: Raw Output Internals,  Prev: Rational Internals,  Up: Internals
1181
118216.3 Float Internals
1183====================
1184
1185Efficient calculation is the primary aim of GMP floats and the use of
1186whole limbs and simple rounding facilitates this.
1187
1188   `mpf_t' floats have a variable precision mantissa and a single
1189machine word signed exponent.  The mantissa is represented using sign
1190and magnitude.
1191
1192        most                   least
1193     significant            significant
1194        limb                   limb
1195
1196                                 _mp_d
1197      |---- _mp_exp --->           |
1198       _____ _____ _____ _____ _____
1199      |_____|_____|_____|_____|_____|
1200                        . <------------ radix point
1201
1202       <-------- _mp_size --------->
1203
1204The fields are as follows.
1205
1206`_mp_size'
1207     The number of limbs currently in use, or the negative of that when
1208     representing a negative value.  Zero is represented by `_mp_size'
1209     and `_mp_exp' both set to zero, and in that case the `_mp_d' data
1210     is unused.  (In the future `_mp_exp' might be undefined when
1211     representing zero.)
1212
1213`_mp_prec'
1214     The precision of the mantissa, in limbs.  In any calculation the
1215     aim is to produce `_mp_prec' limbs of result (the most significant
1216     being non-zero).
1217
1218`_mp_d'
1219     A pointer to the array of limbs which is the absolute value of the
1220     mantissa.  These are stored "little endian" as per the `mpn'
1221     functions, so `_mp_d[0]' is the least significant limb and
1222     `_mp_d[ABS(_mp_size)-1]' the most significant.
1223
1224     The most significant limb is always non-zero, but there are no
1225     other restrictions on its value, in particular the highest 1 bit
1226     can be anywhere within the limb.
1227
1228     `_mp_prec+1' limbs are allocated to `_mp_d', the extra limb being
1229     for convenience (see below).  There are no reallocations during a
1230     calculation, only in a change of precision with `mpf_set_prec'.
1231
1232`_mp_exp'
1233     The exponent, in limbs, determining the location of the implied
1234     radix point.  Zero means the radix point is just above the most
1235     significant limb.  Positive values mean a radix point offset
1236     towards the lower limbs and hence a value >= 1, as for example in
1237     the diagram above.  Negative exponents mean a radix point further
1238     above the highest limb.
1239
1240     Naturally the exponent can be any value, it doesn't have to fall
1241     within the limbs as the diagram shows, it can be a long way above
1242     or a long way below.  Limbs other than those included in the
1243     `{_mp_d,_mp_size}' data are treated as zero.
1244
1245   The `_mp_size' and `_mp_prec' fields are `int', although the
1246`mp_size_t' type is usually a `long'.  The `_mp_exp' field is usually
1247`long'.  This is done to make some fields just 32 bits on some 64 bits
1248systems, thereby saving a few bytes of data space but still providing
1249plenty of precision and a very large range.
1250
1251
1252The following various points should be noted.
1253
1254Low Zeros
1255     The least significant limbs `_mp_d[0]' etc can be zero, though
1256     such low zeros can always be ignored.  Routines likely to produce
1257     low zeros check and avoid them to save time in subsequent
1258     calculations, but for most routines they're quite unlikely and
1259     aren't checked.
1260
1261Mantissa Size Range
1262     The `_mp_size' count of limbs in use can be less than `_mp_prec' if
1263     the value can be represented in less.  This means low precision
1264     values or small integers stored in a high precision `mpf_t' can
1265     still be operated on efficiently.
1266
1267     `_mp_size' can also be greater than `_mp_prec'.  Firstly a value is
1268     allowed to use all of the `_mp_prec+1' limbs available at `_mp_d',
1269     and secondly when `mpf_set_prec_raw' lowers `_mp_prec' it leaves
1270     `_mp_size' unchanged and so the size can be arbitrarily bigger than
1271     `_mp_prec'.
1272
1273Rounding
1274     All rounding is done on limb boundaries.  Calculating `_mp_prec'
1275     limbs with the high non-zero will ensure the application requested
1276     minimum precision is obtained.
1277
1278     The use of simple "trunc" rounding towards zero is efficient,
1279     since there's no need to examine extra limbs and increment or
1280     decrement.
1281
1282Bit Shifts
1283     Since the exponent is in limbs, there are no bit shifts in basic
1284     operations like `mpf_add' and `mpf_mul'.  When differing exponents
1285     are encountered all that's needed is to adjust pointers to line up
1286     the relevant limbs.
1287
1288     Of course `mpf_mul_2exp' and `mpf_div_2exp' will require bit
1289     shifts, but the choice is between an exponent in limbs which
1290     requires shifts there, or one in bits which requires them almost
1291     everywhere else.
1292
1293Use of `_mp_prec+1' Limbs
1294     The extra limb on `_mp_d' (`_mp_prec+1' rather than just
1295     `_mp_prec') helps when an `mpf' routine might get a carry from its
1296     operation.  `mpf_add' for instance will do an `mpn_add' of
1297     `_mp_prec' limbs.  If there's no carry then that's the result, but
1298     if there is a carry then it's stored in the extra limb of space and
1299     `_mp_size' becomes `_mp_prec+1'.
1300
1301     Whenever `_mp_prec+1' limbs are held in a variable, the low limb
1302     is not needed for the intended precision, only the `_mp_prec' high
1303     limbs.  But zeroing it out or moving the rest down is unnecessary.
1304     Subsequent routines reading the value will simply take the high
1305     limbs they need, and this will be `_mp_prec' if their target has
1306     that same precision.  This is no more than a pointer adjustment,
1307     and must be checked anyway since the destination precision can be
1308     different from the sources.
1309
1310     Copy functions like `mpf_set' will retain a full `_mp_prec+1' limbs
1311     if available.  This ensures that a variable which has `_mp_size'
1312     equal to `_mp_prec+1' will get its full exact value copied.
1313     Strictly speaking this is unnecessary since only `_mp_prec' limbs
1314     are needed for the application's requested precision, but it's
1315     considered that an `mpf_set' from one variable into another of the
1316     same precision ought to produce an exact copy.
1317
1318Application Precisions
1319     `__GMPF_BITS_TO_PREC' converts an application requested precision
1320     to an `_mp_prec'.  The value in bits is rounded up to a whole limb
1321     then an extra limb is added since the most significant limb of
1322     `_mp_d' is only non-zero and therefore might contain only one bit.
1323
1324     `__GMPF_PREC_TO_BITS' does the reverse conversion, and removes the
1325     extra limb from `_mp_prec' before converting to bits.  The net
1326     effect of reading back with `mpf_get_prec' is simply the precision
1327     rounded up to a multiple of `mp_bits_per_limb'.
1328
1329     Note that the extra limb added here for the high only being
1330     non-zero is in addition to the extra limb allocated to `_mp_d'.
1331     For example with a 32-bit limb, an application request for 250
1332     bits will be rounded up to 8 limbs, then an extra added for the
1333     high being only non-zero, giving an `_mp_prec' of 9.  `_mp_d' then
1334     gets 10 limbs allocated.  Reading back with `mpf_get_prec' will
1335     take `_mp_prec' subtract 1 limb and multiply by 32, giving 256
1336     bits.
1337
1338     Strictly speaking, the fact the high limb has at least one bit
1339     means that a float with, say, 3 limbs of 32-bits each will be
1340     holding at least 65 bits, but for the purposes of `mpf_t' it's
1341     considered simply to be 64 bits, a nice multiple of the limb size.
1342
1343
1344File: gmp.info,  Node: Raw Output Internals,  Next: C++ Interface Internals,  Prev: Float Internals,  Up: Internals
1345
134616.4 Raw Output Internals
1347=========================
1348
1349`mpz_out_raw' uses the following format.
1350
1351     +------+------------------------+
1352     | size |       data bytes       |
1353     +------+------------------------+
1354
1355   The size is 4 bytes written most significant byte first, being the
1356number of subsequent data bytes, or the twos complement negative of
1357that when a negative integer is represented.  The data bytes are the
1358absolute value of the integer, written most significant byte first.
1359
1360   The most significant data byte is always non-zero, so the output is
1361the same on all systems, irrespective of limb size.
1362
1363   In GMP 1, leading zero bytes were written to pad the data bytes to a
1364multiple of the limb size.  `mpz_inp_raw' will still accept this, for
1365compatibility.
1366
1367   The use of "big endian" for both the size and data fields is
1368deliberate, it makes the data easy to read in a hex dump of a file.
1369Unfortunately it also means that the limb data must be reversed when
1370reading or writing, so neither a big endian nor little endian system
1371can just read and write `_mp_d'.
1372
1373
1374File: gmp.info,  Node: C++ Interface Internals,  Prev: Raw Output Internals,  Up: Internals
1375
137616.5 C++ Interface Internals
1377============================
1378
1379A system of expression templates is used to ensure something like
1380`a=b+c' turns into a simple call to `mpz_add' etc.  For `mpf_class' the
1381scheme also ensures the precision of the final destination is used for
1382any temporaries within a statement like `f=w*x+y*z'.  These are
1383important features which a naive implementation cannot provide.
1384
1385   A simplified description of the scheme follows.  The true scheme is
1386complicated by the fact that expressions have different return types.
1387For detailed information, refer to the source code.
1388
1389   To perform an operation, say, addition, we first define a "function
1390object" evaluating it,
1391
1392     struct __gmp_binary_plus
1393     {
1394       static void eval(mpf_t f, mpf_t g, mpf_t h) { mpf_add(f, g, h); }
1395     };
1396
1397And an "additive expression" object,
1398
1399     __gmp_expr<__gmp_binary_expr<mpf_class, mpf_class, __gmp_binary_plus> >
1400     operator+(const mpf_class &f, const mpf_class &g)
1401     {
1402       return __gmp_expr
1403         <__gmp_binary_expr<mpf_class, mpf_class, __gmp_binary_plus> >(f, g);
1404     }
1405
1406   The seemingly redundant `__gmp_expr<__gmp_binary_expr<...>>' is used
1407to encapsulate any possible kind of expression into a single template
1408type.  In fact even `mpf_class' etc are `typedef' specializations of
1409`__gmp_expr'.
1410
1411   Next we define assignment of `__gmp_expr' to `mpf_class'.
1412
1413     template <class T>
1414     mpf_class & mpf_class::operator=(const __gmp_expr<T> &expr)
1415     {
1416       expr.eval(this->get_mpf_t(), this->precision());
1417       return *this;
1418     }
1419
1420     template <class Op>
1421     void __gmp_expr<__gmp_binary_expr<mpf_class, mpf_class, Op> >::eval
1422     (mpf_t f, mp_bitcnt_t precision)
1423     {
1424       Op::eval(f, expr.val1.get_mpf_t(), expr.val2.get_mpf_t());
1425     }
1426
1427   where `expr.val1' and `expr.val2' are references to the expression's
1428operands (here `expr' is the `__gmp_binary_expr' stored within the
1429`__gmp_expr').
1430
1431   This way, the expression is actually evaluated only at the time of
1432assignment, when the required precision (that of `f') is known.
1433Furthermore the target `mpf_t' is now available, thus we can call
1434`mpf_add' directly with `f' as the output argument.
1435
1436   Compound expressions are handled by defining operators taking
1437subexpressions as their arguments, like this:
1438
1439     template <class T, class U>
1440     __gmp_expr
1441     <__gmp_binary_expr<__gmp_expr<T>, __gmp_expr<U>, __gmp_binary_plus> >
1442     operator+(const __gmp_expr<T> &expr1, const __gmp_expr<U> &expr2)
1443     {
1444       return __gmp_expr
1445         <__gmp_binary_expr<__gmp_expr<T>, __gmp_expr<U>, __gmp_binary_plus> >
1446         (expr1, expr2);
1447     }
1448
1449   And the corresponding specializations of `__gmp_expr::eval':
1450
1451     template <class T, class U, class Op>
1452     void __gmp_expr
1453     <__gmp_binary_expr<__gmp_expr<T>, __gmp_expr<U>, Op> >::eval
1454     (mpf_t f, mp_bitcnt_t precision)
1455     {
1456       // declare two temporaries
1457       mpf_class temp1(expr.val1, precision), temp2(expr.val2, precision);
1458       Op::eval(f, temp1.get_mpf_t(), temp2.get_mpf_t());
1459     }
1460
1461   The expression is thus recursively evaluated to any level of
1462complexity and all subexpressions are evaluated to the precision of `f'.
1463
1464
1465File: gmp.info,  Node: Contributors,  Next: References,  Prev: Internals,  Up: Top
1466
1467Appendix A Contributors
1468***********************
1469
1470Torbj�rn Granlund wrote the original GMP library and is still the main
1471developer.  Code not explicitly attributed to others, was contributed by
1472Torbj�rn.  Several other individuals and organizations have contributed
1473GMP.  Here is a list in chronological order on first contribution:
1474
1475   Gunnar Sj�din and Hans Riesel helped with mathematical problems in
1476early versions of the library.
1477
1478   Richard Stallman helped with the interface design and revised the
1479first version of this manual.
1480
1481   Brian Beuning and Doug Lea helped with testing of early versions of
1482the library and made creative suggestions.
1483
1484   John Amanatides of York University in Canada contributed the function
1485`mpz_probab_prime_p'.
1486
1487   Paul Zimmermann wrote the REDC-based mpz_powm code, the
1488Sch�nhage-Strassen FFT multiply code, and the Karatsuba square root
1489code.  He also improved the Toom3 code for GMP 4.2.  Paul sparked the
1490development of GMP 2, with his comparisons between bignum packages.
1491The ECMNET project Paul is organizing was a driving force behind many
1492of the optimizations in GMP 3.  Paul also wrote the new GMP 4.3 nth
1493root code (with Torbj�rn).
1494
1495   Ken Weber (Kent State University, Universidade Federal do Rio Grande
1496do Sul) contributed now defunct versions of `mpz_gcd', `mpz_divexact',
1497`mpn_gcd', and `mpn_bdivmod', partially supported by CNPq (Brazil)
1498grant 301314194-2.
1499
1500   Per Bothner of Cygnus Support helped to set up GMP to use Cygnus'
1501configure.  He has also made valuable suggestions and tested numerous
1502intermediary releases.
1503
1504   Joachim Hollman was involved in the design of the `mpf' interface,
1505and in the `mpz' design revisions for version 2.
1506
1507   Bennet Yee contributed the initial versions of `mpz_jacobi' and
1508`mpz_legendre'.
1509
1510   Andreas Schwab contributed the files `mpn/m68k/lshift.S' and
1511`mpn/m68k/rshift.S' (now in `.asm' form).
1512
1513   Robert Harley of Inria, France and David Seal of ARM, England,
1514suggested clever improvements for population count.  Robert also wrote
1515highly optimized Karatsuba and 3-way Toom multiplication functions for
1516GMP 3, and contributed the ARM assembly code.
1517
1518   Torsten Ekedahl of the Mathematical department of Stockholm
1519University provided significant inspiration during several phases of
1520the GMP development.  His mathematical expertise helped improve several
1521algorithms.
1522
1523   Linus Nordberg wrote the new configure system based on autoconf and
1524implemented the new random functions.
1525
1526   Kevin Ryde worked on a large number of things: optimized x86 code,
1527m4 asm macros, parameter tuning, speed measuring, the configure system,
1528function inlining, divisibility tests, bit scanning, Jacobi symbols,
1529Fibonacci and Lucas number functions, printf and scanf functions, perl
1530interface, demo expression parser, the algorithms chapter in the
1531manual, `gmpasm-mode.el', and various miscellaneous improvements
1532elsewhere.
1533
1534   Kent Boortz made the Mac OS 9 port.
1535
1536   Steve Root helped write the optimized alpha 21264 assembly code.
1537
1538   Gerardo Ballabio wrote the `gmpxx.h' C++ class interface and the C++
1539`istream' input routines.
1540
1541   Jason Moxham rewrote `mpz_fac_ui'.
1542
1543   Pedro Gimeno implemented the Mersenne Twister and made other random
1544number improvements.
1545
1546   Niels M�ller wrote the sub-quadratic GCD, extended GCD and jacobi
1547code, the quadratic Hensel division code, and (with Torbj�rn) the new
1548divide and conquer division code for GMP 4.3.  Niels also helped
1549implement the new Toom multiply code for GMP 4.3 and implemented helper
1550functions to simplify Toom evaluations for GMP 5.0.  He wrote the
1551original version of mpn_mulmod_bnm1, and he is the main author of the
1552mini-gmp package used for gmp bootstrapping.
1553
1554   Alberto Zanoni and Marco Bodrato suggested the unbalanced multiply
1555strategy, and found the optimal strategies for evaluation and
1556interpolation in Toom multiplication.
1557
1558   Marco Bodrato helped implement the new Toom multiply code for GMP
15594.3 and implemented most of the new Toom multiply and squaring code for
15605.0.  He is the main author of the current mpn_mulmod_bnm1 and
1561mpn_mullo_n.  Marco also wrote the functions mpn_invert and
1562mpn_invertappr.  He is the author of the current combinatorial
1563functions: binomial, factorial, multifactorial, primorial.
1564
1565   David Harvey suggested the internal function `mpn_bdiv_dbm1',
1566implementing division relevant to Toom multiplication.  He also worked
1567on fast assembly sequences, in particular on a fast AMD64
1568`mpn_mul_basecase'. He wrote the internal middle product functions
1569`mpn_mulmid_basecase', `mpn_toom42_mulmid', `mpn_mulmid_n' and related
1570helper routines.
1571
1572   Martin Boij wrote `mpn_perfect_power_p'.
1573
1574   Marc Glisse improved `gmpxx.h': use fewer temporaries (faster),
1575specializations of `numeric_limits' and `common_type', C++11 features
1576(move constructors, explicit bool conversion, UDL), make the conversion
1577from `mpq_class' to `mpz_class' explicit, optimize operations where one
1578argument is a small compile-time constant, replace some heap
1579allocations by stack allocations.  He also fixed the eofbit handling of
1580C++ streams, and removed one division from `mpq/aors.c'.
1581
1582   (This list is chronological, not ordered after significance.  If you
1583have contributed to GMP but are not listed above, please tell
1584<gmp-devel@gmplib.org> about the omission!)
1585
1586   The development of floating point functions of GNU MP 2, were
1587supported in part by the ESPRIT-BRA (Basic Research Activities) 6846
1588project POSSO (POlynomial System SOlving).
1589
1590   The development of GMP 2, 3, and 4 was supported in part by the IDA
1591Center for Computing Sciences.
1592
1593   Thanks go to Hans Thorsen for donating an SGI system for the GMP
1594test system environment.
1595
1596
1597File: gmp.info,  Node: References,  Next: GNU Free Documentation License,  Prev: Contributors,  Up: Top
1598
1599Appendix B References
1600*********************
1601
1602B.1 Books
1603=========
1604
1605   * Jonathan M. Borwein and Peter B. Borwein, "Pi and the AGM: A Study
1606     in Analytic Number Theory and Computational Complexity", Wiley,
1607     1998.
1608
1609   * Richard Crandall and Carl Pomerance, "Prime Numbers: A
1610     Computational Perspective", 2nd edition, Springer-Verlag, 2005.
1611     `http://www.math.dartmouth.edu/~carlp/'
1612
1613   * Henri Cohen, "A Course in Computational Algebraic Number Theory",
1614     Graduate Texts in Mathematics number 138, Springer-Verlag, 1993.
1615     `http://www.math.u-bordeaux.fr/~cohen/'
1616
1617   * Donald E. Knuth, "The Art of Computer Programming", volume 2,
1618     "Seminumerical Algorithms", 3rd edition, Addison-Wesley, 1998.
1619     `http://www-cs-faculty.stanford.edu/~knuth/taocp.html'
1620
1621   * John D. Lipson, "Elements of Algebra and Algebraic Computing", The
1622     Benjamin Cummings Publishing Company Inc, 1981.
1623
1624   * Alfred J. Menezes, Paul C. van Oorschot and Scott A. Vanstone,
1625     "Handbook of Applied Cryptography",
1626     `http://www.cacr.math.uwaterloo.ca/hac/'
1627
1628   * Richard M. Stallman and the GCC Developer Community, "Using the
1629     GNU Compiler Collection", Free Software Foundation, 2008,
1630     available online `http://gcc.gnu.org/onlinedocs/', and in the GCC
1631     package `ftp://ftp.gnu.org/gnu/gcc/'
1632
1633B.2 Papers
1634==========
1635
1636   * Yves Bertot, Nicolas Magaud and Paul Zimmermann, "A Proof of GMP
1637     Square Root", Journal of Automated Reasoning, volume 29, 2002, pp.
1638     225-252.  Also available online as INRIA Research Report 4475,
1639     June 2002, `http://hal.inria.fr/docs/00/07/21/13/PDF/RR-4475.pdf'
1640
1641   * Christoph Burnikel and Joachim Ziegler, "Fast Recursive Division",
1642     Max-Planck-Institut fuer Informatik Research Report MPI-I-98-1-022,
1643     `http://data.mpi-sb.mpg.de/internet/reports.nsf/NumberView/1998-1-022'
1644
1645   * Torbj�rn Granlund and Peter L. Montgomery, "Division by Invariant
1646     Integers using Multiplication", in Proceedings of the SIGPLAN
1647     PLDI'94 Conference, June 1994.  Also available
1648     `http://gmplib.org/~tege/divcnst-pldi94.pdf'.
1649
1650   * Niels M�ller and Torbj�rn Granlund, "Improved division by invariant
1651     integers", IEEE Transactions on Computers, 11 June 2010.
1652     `http://gmplib.org/~tege/division-paper.pdf'
1653
1654   * Torbj�rn Granlund and Niels M�ller, "Division of integers large and
1655     small", to appear.
1656
1657   * Tudor Jebelean, "An algorithm for exact division", Journal of
1658     Symbolic Computation, volume 15, 1993, pp. 169-180.  Research
1659     report version available
1660     `ftp://ftp.risc.uni-linz.ac.at/pub/techreports/1992/92-35.ps.gz'
1661
1662   * Tudor Jebelean, "Exact Division with Karatsuba Complexity -
1663     Extended Abstract", RISC-Linz technical report 96-31,
1664     `ftp://ftp.risc.uni-linz.ac.at/pub/techreports/1996/96-31.ps.gz'
1665
1666   * Tudor Jebelean, "Practical Integer Division with Karatsuba
1667     Complexity", ISSAC 97, pp. 339-341.  Technical report available
1668     `ftp://ftp.risc.uni-linz.ac.at/pub/techreports/1996/96-29.ps.gz'
1669
1670   * Tudor Jebelean, "A Generalization of the Binary GCD Algorithm",
1671     ISSAC 93, pp. 111-116.  Technical report version available
1672     `ftp://ftp.risc.uni-linz.ac.at/pub/techreports/1993/93-01.ps.gz'
1673
1674   * Tudor Jebelean, "A Double-Digit Lehmer-Euclid Algorithm for
1675     Finding the GCD of Long Integers", Journal of Symbolic
1676     Computation, volume 19, 1995, pp. 145-157.  Technical report
1677     version also available
1678     `ftp://ftp.risc.uni-linz.ac.at/pub/techreports/1992/92-69.ps.gz'
1679
1680   * Werner Krandick and Tudor Jebelean, "Bidirectional Exact Integer
1681     Division", Journal of Symbolic Computation, volume 21, 1996, pp.
1682     441-455.  Early technical report version also available
1683     `ftp://ftp.risc.uni-linz.ac.at/pub/techreports/1994/94-50.ps.gz'
1684
1685   * Makoto Matsumoto and Takuji Nishimura, "Mersenne Twister: A
1686     623-dimensionally equidistributed uniform pseudorandom number
1687     generator", ACM Transactions on Modelling and Computer Simulation,
1688     volume 8, January 1998, pp. 3-30.  Available online
1689     `http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/ARTICLES/mt.ps.gz'
1690     (or .pdf)
1691
1692   * R. Moenck and A. Borodin, "Fast Modular Transforms via Division",
1693     Proceedings of the 13th Annual IEEE Symposium on Switching and
1694     Automata Theory, October 1972, pp. 90-96.  Reprinted as "Fast
1695     Modular Transforms", Journal of Computer and System Sciences,
1696     volume 8, number 3, June 1974, pp. 366-386.
1697
1698   * Niels M�ller, "On Sch�nhage's algorithm and subquadratic integer
1699     GCD   computation", in Mathematics of Computation, volume 77,
1700     January 2008, pp.    589-607.
1701
1702   * Peter L. Montgomery, "Modular Multiplication Without Trial
1703     Division", in Mathematics of Computation, volume 44, number 170,
1704     April 1985.
1705
1706   * Arnold Sch�nhage and Volker Strassen, "Schnelle Multiplikation
1707     grosser Zahlen", Computing 7, 1971, pp. 281-292.
1708
1709   * Kenneth Weber, "The accelerated integer GCD algorithm", ACM
1710     Transactions on Mathematical Software, volume 21, number 1, March
1711     1995, pp. 111-122.
1712
1713   * Paul Zimmermann, "Karatsuba Square Root", INRIA Research Report
1714     3805, November 1999,
1715     `http://hal.inria.fr/inria-00072854/PDF/RR-3805.pdf'
1716
1717   * Paul Zimmermann, "A Proof of GMP Fast Division and Square Root
1718     Implementations",
1719     `http://www.loria.fr/~zimmerma/papers/proof-div-sqrt.ps.gz'
1720
1721   * Dan Zuras, "On Squaring and Multiplying Large Integers", ARITH-11:
1722     IEEE Symposium on Computer Arithmetic, 1993, pp. 260 to 271.
1723     Reprinted as "More on Multiplying and Squaring Large Integers",
1724     IEEE Transactions on Computers, volume 43, number 8, August 1994,
1725     pp. 899-908.
1726
1727
1728File: gmp.info,  Node: GNU Free Documentation License,  Next: Concept Index,  Prev: References,  Up: Top
1729
1730Appendix C GNU Free Documentation License
1731*****************************************
1732
1733                     Version 1.3, 3 November 2008
1734
1735     Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
1736     `http://fsf.org/'
1737
1738     Everyone is permitted to copy and distribute verbatim copies
1739     of this license document, but changing it is not allowed.
1740
1741  0. PREAMBLE
1742
1743     The purpose of this License is to make a manual, textbook, or other
1744     functional and useful document "free" in the sense of freedom: to
1745     assure everyone the effective freedom to copy and redistribute it,
1746     with or without modifying it, either commercially or
1747     noncommercially.  Secondarily, this License preserves for the
1748     author and publisher a way to get credit for their work, while not
1749     being considered responsible for modifications made by others.
1750
1751     This License is a kind of "copyleft", which means that derivative
1752     works of the document must themselves be free in the same sense.
1753     It complements the GNU General Public License, which is a copyleft
1754     license designed for free software.
1755
1756     We have designed this License in order to use it for manuals for
1757     free software, because free software needs free documentation: a
1758     free program should come with manuals providing the same freedoms
1759     that the software does.  But this License is not limited to
1760     software manuals; it can be used for any textual work, regardless
1761     of subject matter or whether it is published as a printed book.
1762     We recommend this License principally for works whose purpose is
1763     instruction or reference.
1764
1765  1. APPLICABILITY AND DEFINITIONS
1766
1767     This License applies to any manual or other work, in any medium,
1768     that contains a notice placed by the copyright holder saying it
1769     can be distributed under the terms of this License.  Such a notice
1770     grants a world-wide, royalty-free license, unlimited in duration,
1771     to use that work under the conditions stated herein.  The
1772     "Document", below, refers to any such manual or work.  Any member
1773     of the public is a licensee, and is addressed as "you".  You
1774     accept the license if you copy, modify or distribute the work in a
1775     way requiring permission under copyright law.
1776
1777     A "Modified Version" of the Document means any work containing the
1778     Document or a portion of it, either copied verbatim, or with
1779     modifications and/or translated into another language.
1780
1781     A "Secondary Section" is a named appendix or a front-matter section
1782     of the Document that deals exclusively with the relationship of the
1783     publishers or authors of the Document to the Document's overall
1784     subject (or to related matters) and contains nothing that could
1785     fall directly within that overall subject.  (Thus, if the Document
1786     is in part a textbook of mathematics, a Secondary Section may not
1787     explain any mathematics.)  The relationship could be a matter of
1788     historical connection with the subject or with related matters, or
1789     of legal, commercial, philosophical, ethical or political position
1790     regarding them.
1791
1792     The "Invariant Sections" are certain Secondary Sections whose
1793     titles are designated, as being those of Invariant Sections, in
1794     the notice that says that the Document is released under this
1795     License.  If a section does not fit the above definition of
1796     Secondary then it is not allowed to be designated as Invariant.
1797     The Document may contain zero Invariant Sections.  If the Document
1798     does not identify any Invariant Sections then there are none.
1799
1800     The "Cover Texts" are certain short passages of text that are
1801     listed, as Front-Cover Texts or Back-Cover Texts, in the notice
1802     that says that the Document is released under this License.  A
1803     Front-Cover Text may be at most 5 words, and a Back-Cover Text may
1804     be at most 25 words.
1805
1806     A "Transparent" copy of the Document means a machine-readable copy,
1807     represented in a format whose specification is available to the
1808     general public, that is suitable for revising the document
1809     straightforwardly with generic text editors or (for images
1810     composed of pixels) generic paint programs or (for drawings) some
1811     widely available drawing editor, and that is suitable for input to
1812     text formatters or for automatic translation to a variety of
1813     formats suitable for input to text formatters.  A copy made in an
1814     otherwise Transparent file format whose markup, or absence of
1815     markup, has been arranged to thwart or discourage subsequent
1816     modification by readers is not Transparent.  An image format is
1817     not Transparent if used for any substantial amount of text.  A
1818     copy that is not "Transparent" is called "Opaque".
1819
1820     Examples of suitable formats for Transparent copies include plain
1821     ASCII without markup, Texinfo input format, LaTeX input format,
1822     SGML or XML using a publicly available DTD, and
1823     standard-conforming simple HTML, PostScript or PDF designed for
1824     human modification.  Examples of transparent image formats include
1825     PNG, XCF and JPG.  Opaque formats include proprietary formats that
1826     can be read and edited only by proprietary word processors, SGML or
1827     XML for which the DTD and/or processing tools are not generally
1828     available, and the machine-generated HTML, PostScript or PDF
1829     produced by some word processors for output purposes only.
1830
1831     The "Title Page" means, for a printed book, the title page itself,
1832     plus such following pages as are needed to hold, legibly, the
1833     material this License requires to appear in the title page.  For
1834     works in formats which do not have any title page as such, "Title
1835     Page" means the text near the most prominent appearance of the
1836     work's title, preceding the beginning of the body of the text.
1837
1838     The "publisher" means any person or entity that distributes copies
1839     of the Document to the public.
1840
1841     A section "Entitled XYZ" means a named subunit of the Document
1842     whose title either is precisely XYZ or contains XYZ in parentheses
1843     following text that translates XYZ in another language.  (Here XYZ
1844     stands for a specific section name mentioned below, such as
1845     "Acknowledgements", "Dedications", "Endorsements", or "History".)
1846     To "Preserve the Title" of such a section when you modify the
1847     Document means that it remains a section "Entitled XYZ" according
1848     to this definition.
1849
1850     The Document may include Warranty Disclaimers next to the notice
1851     which states that this License applies to the Document.  These
1852     Warranty Disclaimers are considered to be included by reference in
1853     this License, but only as regards disclaiming warranties: any other
1854     implication that these Warranty Disclaimers may have is void and
1855     has no effect on the meaning of this License.
1856
1857  2. VERBATIM COPYING
1858
1859     You may copy and distribute the Document in any medium, either
1860     commercially or noncommercially, provided that this License, the
1861     copyright notices, and the license notice saying this License
1862     applies to the Document are reproduced in all copies, and that you
1863     add no other conditions whatsoever to those of this License.  You
1864     may not use technical measures to obstruct or control the reading
1865     or further copying of the copies you make or distribute.  However,
1866     you may accept compensation in exchange for copies.  If you
1867     distribute a large enough number of copies you must also follow
1868     the conditions in section 3.
1869
1870     You may also lend copies, under the same conditions stated above,
1871     and you may publicly display copies.
1872
1873  3. COPYING IN QUANTITY
1874
1875     If you publish printed copies (or copies in media that commonly
1876     have printed covers) of the Document, numbering more than 100, and
1877     the Document's license notice requires Cover Texts, you must
1878     enclose the copies in covers that carry, clearly and legibly, all
1879     these Cover Texts: Front-Cover Texts on the front cover, and
1880     Back-Cover Texts on the back cover.  Both covers must also clearly
1881     and legibly identify you as the publisher of these copies.  The
1882     front cover must present the full title with all words of the
1883     title equally prominent and visible.  You may add other material
1884     on the covers in addition.  Copying with changes limited to the
1885     covers, as long as they preserve the title of the Document and
1886     satisfy these conditions, can be treated as verbatim copying in
1887     other respects.
1888
1889     If the required texts for either cover are too voluminous to fit
1890     legibly, you should put the first ones listed (as many as fit
1891     reasonably) on the actual cover, and continue the rest onto
1892     adjacent pages.
1893
1894     If you publish or distribute Opaque copies of the Document
1895     numbering more than 100, you must either include a
1896     machine-readable Transparent copy along with each Opaque copy, or
1897     state in or with each Opaque copy a computer-network location from
1898     which the general network-using public has access to download
1899     using public-standard network protocols a complete Transparent
1900     copy of the Document, free of added material.  If you use the
1901     latter option, you must take reasonably prudent steps, when you
1902     begin distribution of Opaque copies in quantity, to ensure that
1903     this Transparent copy will remain thus accessible at the stated
1904     location until at least one year after the last time you
1905     distribute an Opaque copy (directly or through your agents or
1906     retailers) of that edition to the public.
1907
1908     It is requested, but not required, that you contact the authors of
1909     the Document well before redistributing any large number of
1910     copies, to give them a chance to provide you with an updated
1911     version of the Document.
1912
1913  4. MODIFICATIONS
1914
1915     You may copy and distribute a Modified Version of the Document
1916     under the conditions of sections 2 and 3 above, provided that you
1917     release the Modified Version under precisely this License, with
1918     the Modified Version filling the role of the Document, thus
1919     licensing distribution and modification of the Modified Version to
1920     whoever possesses a copy of it.  In addition, you must do these
1921     things in the Modified Version:
1922
1923       A. Use in the Title Page (and on the covers, if any) a title
1924          distinct from that of the Document, and from those of
1925          previous versions (which should, if there were any, be listed
1926          in the History section of the Document).  You may use the
1927          same title as a previous version if the original publisher of
1928          that version gives permission.
1929
1930       B. List on the Title Page, as authors, one or more persons or
1931          entities responsible for authorship of the modifications in
1932          the Modified Version, together with at least five of the
1933          principal authors of the Document (all of its principal
1934          authors, if it has fewer than five), unless they release you
1935          from this requirement.
1936
1937       C. State on the Title page the name of the publisher of the
1938          Modified Version, as the publisher.
1939
1940       D. Preserve all the copyright notices of the Document.
1941
1942       E. Add an appropriate copyright notice for your modifications
1943          adjacent to the other copyright notices.
1944
1945       F. Include, immediately after the copyright notices, a license
1946          notice giving the public permission to use the Modified
1947          Version under the terms of this License, in the form shown in
1948          the Addendum below.
1949
1950       G. Preserve in that license notice the full lists of Invariant
1951          Sections and required Cover Texts given in the Document's
1952          license notice.
1953
1954       H. Include an unaltered copy of this License.
1955
1956       I. Preserve the section Entitled "History", Preserve its Title,
1957          and add to it an item stating at least the title, year, new
1958          authors, and publisher of the Modified Version as given on
1959          the Title Page.  If there is no section Entitled "History" in
1960          the Document, create one stating the title, year, authors,
1961          and publisher of the Document as given on its Title Page,
1962          then add an item describing the Modified Version as stated in
1963          the previous sentence.
1964
1965       J. Preserve the network location, if any, given in the Document
1966          for public access to a Transparent copy of the Document, and
1967          likewise the network locations given in the Document for
1968          previous versions it was based on.  These may be placed in
1969          the "History" section.  You may omit a network location for a
1970          work that was published at least four years before the
1971          Document itself, or if the original publisher of the version
1972          it refers to gives permission.
1973
1974       K. For any section Entitled "Acknowledgements" or "Dedications",
1975          Preserve the Title of the section, and preserve in the
1976          section all the substance and tone of each of the contributor
1977          acknowledgements and/or dedications given therein.
1978
1979       L. Preserve all the Invariant Sections of the Document,
1980          unaltered in their text and in their titles.  Section numbers
1981          or the equivalent are not considered part of the section
1982          titles.
1983
1984       M. Delete any section Entitled "Endorsements".  Such a section
1985          may not be included in the Modified Version.
1986
1987       N. Do not retitle any existing section to be Entitled
1988          "Endorsements" or to conflict in title with any Invariant
1989          Section.
1990
1991       O. Preserve any Warranty Disclaimers.
1992
1993     If the Modified Version includes new front-matter sections or
1994     appendices that qualify as Secondary Sections and contain no
1995     material copied from the Document, you may at your option
1996     designate some or all of these sections as invariant.  To do this,
1997     add their titles to the list of Invariant Sections in the Modified
1998     Version's license notice.  These titles must be distinct from any
1999     other section titles.
2000
2001     You may add a section Entitled "Endorsements", provided it contains
2002     nothing but endorsements of your Modified Version by various
2003     parties--for example, statements of peer review or that the text
2004     has been approved by an organization as the authoritative
2005     definition of a standard.
2006
2007     You may add a passage of up to five words as a Front-Cover Text,
2008     and a passage of up to 25 words as a Back-Cover Text, to the end
2009     of the list of Cover Texts in the Modified Version.  Only one
2010     passage of Front-Cover Text and one of Back-Cover Text may be
2011     added by (or through arrangements made by) any one entity.  If the
2012     Document already includes a cover text for the same cover,
2013     previously added by you or by arrangement made by the same entity
2014     you are acting on behalf of, you may not add another; but you may
2015     replace the old one, on explicit permission from the previous
2016     publisher that added the old one.
2017
2018     The author(s) and publisher(s) of the Document do not by this
2019     License give permission to use their names for publicity for or to
2020     assert or imply endorsement of any Modified Version.
2021
2022  5. COMBINING DOCUMENTS
2023
2024     You may combine the Document with other documents released under
2025     this License, under the terms defined in section 4 above for
2026     modified versions, provided that you include in the combination
2027     all of the Invariant Sections of all of the original documents,
2028     unmodified, and list them all as Invariant Sections of your
2029     combined work in its license notice, and that you preserve all
2030     their Warranty Disclaimers.
2031
2032     The combined work need only contain one copy of this License, and
2033     multiple identical Invariant Sections may be replaced with a single
2034     copy.  If there are multiple Invariant Sections with the same name
2035     but different contents, make the title of each such section unique
2036     by adding at the end of it, in parentheses, the name of the
2037     original author or publisher of that section if known, or else a
2038     unique number.  Make the same adjustment to the section titles in
2039     the list of Invariant Sections in the license notice of the
2040     combined work.
2041
2042     In the combination, you must combine any sections Entitled
2043     "History" in the various original documents, forming one section
2044     Entitled "History"; likewise combine any sections Entitled
2045     "Acknowledgements", and any sections Entitled "Dedications".  You
2046     must delete all sections Entitled "Endorsements."
2047
2048  6. COLLECTIONS OF DOCUMENTS
2049
2050     You may make a collection consisting of the Document and other
2051     documents released under this License, and replace the individual
2052     copies of this License in the various documents with a single copy
2053     that is included in the collection, provided that you follow the
2054     rules of this License for verbatim copying of each of the
2055     documents in all other respects.
2056
2057     You may extract a single document from such a collection, and
2058     distribute it individually under this License, provided you insert
2059     a copy of this License into the extracted document, and follow
2060     this License in all other respects regarding verbatim copying of
2061     that document.
2062
2063  7. AGGREGATION WITH INDEPENDENT WORKS
2064
2065     A compilation of the Document or its derivatives with other
2066     separate and independent documents or works, in or on a volume of
2067     a storage or distribution medium, is called an "aggregate" if the
2068     copyright resulting from the compilation is not used to limit the
2069     legal rights of the compilation's users beyond what the individual
2070     works permit.  When the Document is included in an aggregate, this
2071     License does not apply to the other works in the aggregate which
2072     are not themselves derivative works of the Document.
2073
2074     If the Cover Text requirement of section 3 is applicable to these
2075     copies of the Document, then if the Document is less than one half
2076     of the entire aggregate, the Document's Cover Texts may be placed
2077     on covers that bracket the Document within the aggregate, or the
2078     electronic equivalent of covers if the Document is in electronic
2079     form.  Otherwise they must appear on printed covers that bracket
2080     the whole aggregate.
2081
2082  8. TRANSLATION
2083
2084     Translation is considered a kind of modification, so you may
2085     distribute translations of the Document under the terms of section
2086     4.  Replacing Invariant Sections with translations requires special
2087     permission from their copyright holders, but you may include
2088     translations of some or all Invariant Sections in addition to the
2089     original versions of these Invariant Sections.  You may include a
2090     translation of this License, and all the license notices in the
2091     Document, and any Warranty Disclaimers, provided that you also
2092     include the original English version of this License and the
2093     original versions of those notices and disclaimers.  In case of a
2094     disagreement between the translation and the original version of
2095     this License or a notice or disclaimer, the original version will
2096     prevail.
2097
2098     If a section in the Document is Entitled "Acknowledgements",
2099     "Dedications", or "History", the requirement (section 4) to
2100     Preserve its Title (section 1) will typically require changing the
2101     actual title.
2102
2103  9. TERMINATION
2104
2105     You may not copy, modify, sublicense, or distribute the Document
2106     except as expressly provided under this License.  Any attempt
2107     otherwise to copy, modify, sublicense, or distribute it is void,
2108     and will automatically terminate your rights under this License.
2109
2110     However, if you cease all violation of this License, then your
2111     license from a particular copyright holder is reinstated (a)
2112     provisionally, unless and until the copyright holder explicitly
2113     and finally terminates your license, and (b) permanently, if the
2114     copyright holder fails to notify you of the violation by some
2115     reasonable means prior to 60 days after the cessation.
2116
2117     Moreover, your license from a particular copyright holder is
2118     reinstated permanently if the copyright holder notifies you of the
2119     violation by some reasonable means, this is the first time you have
2120     received notice of violation of this License (for any work) from
2121     that copyright holder, and you cure the violation prior to 30 days
2122     after your receipt of the notice.
2123
2124     Termination of your rights under this section does not terminate
2125     the licenses of parties who have received copies or rights from
2126     you under this License.  If your rights have been terminated and
2127     not permanently reinstated, receipt of a copy of some or all of
2128     the same material does not give you any rights to use it.
2129
2130 10. FUTURE REVISIONS OF THIS LICENSE
2131
2132     The Free Software Foundation may publish new, revised versions of
2133     the GNU Free Documentation License from time to time.  Such new
2134     versions will be similar in spirit to the present version, but may
2135     differ in detail to address new problems or concerns.  See
2136     `http://www.gnu.org/copyleft/'.
2137
2138     Each version of the License is given a distinguishing version
2139     number.  If the Document specifies that a particular numbered
2140     version of this License "or any later version" applies to it, you
2141     have the option of following the terms and conditions either of
2142     that specified version or of any later version that has been
2143     published (not as a draft) by the Free Software Foundation.  If
2144     the Document does not specify a version number of this License,
2145     you may choose any version ever published (not as a draft) by the
2146     Free Software Foundation.  If the Document specifies that a proxy
2147     can decide which future versions of this License can be used, that
2148     proxy's public statement of acceptance of a version permanently
2149     authorizes you to choose that version for the Document.
2150
2151 11. RELICENSING
2152
2153     "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
2154     World Wide Web server that publishes copyrightable works and also
2155     provides prominent facilities for anybody to edit those works.  A
2156     public wiki that anybody can edit is an example of such a server.
2157     A "Massive Multiauthor Collaboration" (or "MMC") contained in the
2158     site means any set of copyrightable works thus published on the MMC
2159     site.
2160
2161     "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
2162     license published by Creative Commons Corporation, a not-for-profit
2163     corporation with a principal place of business in San Francisco,
2164     California, as well as future copyleft versions of that license
2165     published by that same organization.
2166
2167     "Incorporate" means to publish or republish a Document, in whole or
2168     in part, as part of another Document.
2169
2170     An MMC is "eligible for relicensing" if it is licensed under this
2171     License, and if all works that were first published under this
2172     License somewhere other than this MMC, and subsequently
2173     incorporated in whole or in part into the MMC, (1) had no cover
2174     texts or invariant sections, and (2) were thus incorporated prior
2175     to November 1, 2008.
2176
2177     The operator of an MMC Site may republish an MMC contained in the
2178     site under CC-BY-SA on the same site at any time before August 1,
2179     2009, provided the MMC is eligible for relicensing.
2180
2181
2182ADDENDUM: How to use this License for your documents
2183====================================================
2184
2185To use this License in a document you have written, include a copy of
2186the License in the document and put the following copyright and license
2187notices just after the title page:
2188
2189       Copyright (C)  YEAR  YOUR NAME.
2190       Permission is granted to copy, distribute and/or modify this document
2191       under the terms of the GNU Free Documentation License, Version 1.3
2192       or any later version published by the Free Software Foundation;
2193       with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
2194       Texts.  A copy of the license is included in the section entitled ``GNU
2195       Free Documentation License''.
2196
2197   If you have Invariant Sections, Front-Cover Texts and Back-Cover
2198Texts, replace the "with...Texts." line with this:
2199
2200         with the Invariant Sections being LIST THEIR TITLES, with
2201         the Front-Cover Texts being LIST, and with the Back-Cover Texts
2202         being LIST.
2203
2204   If you have Invariant Sections without Cover Texts, or some other
2205combination of the three, merge those two alternatives to suit the
2206situation.
2207
2208   If your document contains nontrivial examples of program code, we
2209recommend releasing these examples in parallel under your choice of
2210free software license, such as the GNU General Public License, to
2211permit their use in free software.
2212
2213
2214File: gmp.info,  Node: Concept Index,  Next: Function Index,  Prev: GNU Free Documentation License,  Up: Top
2215
2216Concept Index
2217*************
2218
2219�[index�]
2220* Menu:
2221
2222* #include:                              Headers and Libraries.
2223                                                              (line   6)
2224* --build:                               Build Options.       (line  52)
2225* --disable-fft:                         Build Options.       (line 314)
2226* --disable-shared:                      Build Options.       (line  45)
2227* --disable-static:                      Build Options.       (line  45)
2228* --enable-alloca:                       Build Options.       (line 275)
2229* --enable-assert:                       Build Options.       (line 320)
2230* --enable-cxx:                          Build Options.       (line 227)
2231* --enable-fat:                          Build Options.       (line 162)
2232* --enable-profiling <1>:                Build Options.       (line 324)
2233* --enable-profiling:                    Profiling.           (line   6)
2234* --exec-prefix:                         Build Options.       (line  32)
2235* --host:                                Build Options.       (line  66)
2236* --prefix:                              Build Options.       (line  32)
2237* -finstrument-functions:                Profiling.           (line  66)
2238* 2exp functions:                        Efficiency.          (line  43)
2239* 68000:                                 Notes for Particular Systems.
2240                                                              (line  80)
2241* 80x86:                                 Notes for Particular Systems.
2242                                                              (line 127)
2243* ABI <1>:                               Build Options.       (line 169)
2244* ABI:                                   ABI and ISA.         (line   6)
2245* About this manual:                     Introduction to GMP. (line  58)
2246* AC_CHECK_LIB:                          Autoconf.            (line  11)
2247* AIX <1>:                               Notes for Particular Systems.
2248                                                              (line   7)
2249* AIX:                                   ABI and ISA.         (line 169)
2250* Algorithms:                            Algorithms.          (line   6)
2251* alloca:                                Build Options.       (line 275)
2252* Allocation of memory:                  Custom Allocation.   (line   6)
2253* AMD64:                                 ABI and ISA.         (line  44)
2254* Anonymous FTP of latest version:       Introduction to GMP. (line  38)
2255* Application Binary Interface:          ABI and ISA.         (line   6)
2256* Arithmetic functions <1>:              Rational Arithmetic. (line   6)
2257* Arithmetic functions <2>:              Float Arithmetic.    (line   6)
2258* Arithmetic functions:                  Integer Arithmetic.  (line   6)
2259* ARM:                                   Notes for Particular Systems.
2260                                                              (line  20)
2261* Assembly cache handling:               Assembly Cache Handling.
2262                                                              (line   6)
2263* Assembly carry propagation:            Assembly Carry Propagation.
2264                                                              (line   6)
2265* Assembly code organisation:            Assembly Code Organisation.
2266                                                              (line   6)
2267* Assembly coding:                       Assembly Coding.     (line   6)
2268* Assembly floating Point:               Assembly Floating Point.
2269                                                              (line   6)
2270* Assembly loop unrolling:               Assembly Loop Unrolling.
2271                                                              (line   6)
2272* Assembly SIMD:                         Assembly SIMD Instructions.
2273                                                              (line   6)
2274* Assembly software pipelining:          Assembly Software Pipelining.
2275                                                              (line   6)
2276* Assembly writing guide:                Assembly Writing Guide.
2277                                                              (line   6)
2278* Assertion checking <1>:                Build Options.       (line 320)
2279* Assertion checking:                    Debugging.           (line  79)
2280* Assignment functions <1>:              Assigning Integers.  (line   6)
2281* Assignment functions <2>:              Initializing Rationals.
2282                                                              (line   6)
2283* Assignment functions <3>:              Assigning Floats.    (line   6)
2284* Assignment functions <4>:              Simultaneous Float Init & Assign.
2285                                                              (line   6)
2286* Assignment functions:                  Simultaneous Integer Init & Assign.
2287                                                              (line   6)
2288* Autoconf:                              Autoconf.            (line   6)
2289* Basics:                                GMP Basics.          (line   6)
2290* Binomial coefficient algorithm:        Binomial Coefficients Algorithm.
2291                                                              (line   6)
2292* Binomial coefficient functions:        Number Theoretic Functions.
2293                                                              (line 128)
2294* Binutils strip:                        Known Build Problems.
2295                                                              (line  28)
2296* Bit manipulation functions:            Integer Logic and Bit Fiddling.
2297                                                              (line   6)
2298* Bit scanning functions:                Integer Logic and Bit Fiddling.
2299                                                              (line  40)
2300* Bit shift left:                        Integer Arithmetic.  (line  38)
2301* Bit shift right:                       Integer Division.    (line  62)
2302* Bits per limb:                         Useful Macros and Constants.
2303                                                              (line   7)
2304* Bug reporting:                         Reporting Bugs.      (line   6)
2305* Build directory:                       Build Options.       (line  19)
2306* Build notes for binary packaging:      Notes for Package Builds.
2307                                                              (line   6)
2308* Build notes for particular systems:    Notes for Particular Systems.
2309                                                              (line   6)
2310* Build options:                         Build Options.       (line   6)
2311* Build problems known:                  Known Build Problems.
2312                                                              (line   6)
2313* Build system:                          Build Options.       (line  52)
2314* Building GMP:                          Installing GMP.      (line   6)
2315* Bus error:                             Debugging.           (line   7)
2316* C compiler:                            Build Options.       (line 180)
2317* C++ compiler:                          Build Options.       (line 251)
2318* C++ interface:                         C++ Class Interface. (line   6)
2319* C++ interface internals:               C++ Interface Internals.
2320                                                              (line   6)
2321* C++ istream input:                     C++ Formatted Input. (line   6)
2322* C++ ostream output:                    C++ Formatted Output.
2323                                                              (line   6)
2324* C++ support:                           Build Options.       (line 227)
2325* CC:                                    Build Options.       (line 180)
2326* CC_FOR_BUILD:                          Build Options.       (line 214)
2327* CFLAGS:                                Build Options.       (line 180)
2328* Checker:                               Debugging.           (line 115)
2329* checkergcc:                            Debugging.           (line 122)
2330* Code organisation:                     Assembly Code Organisation.
2331                                                              (line   6)
2332* Compaq C++:                            Notes for Particular Systems.
2333                                                              (line  25)
2334* Comparison functions <1>:              Comparing Rationals. (line   6)
2335* Comparison functions <2>:              Float Comparison.    (line   6)
2336* Comparison functions:                  Integer Comparisons. (line   6)
2337* Compatibility with older versions:     Compatibility with older versions.
2338                                                              (line   6)
2339* Conditions for copying GNU MP:         Copying.             (line   6)
2340* Configuring GMP:                       Installing GMP.      (line   6)
2341* Congruence algorithm:                  Exact Remainder.     (line  30)
2342* Congruence functions:                  Integer Division.    (line 137)
2343* Constants:                             Useful Macros and Constants.
2344                                                              (line   6)
2345* Contributors:                          Contributors.        (line   6)
2346* Conventions for parameters:            Parameter Conventions.
2347                                                              (line   6)
2348* Conventions for variables:             Variable Conventions.
2349                                                              (line   6)
2350* Conversion functions <1>:              Converting Integers. (line   6)
2351* Conversion functions <2>:              Converting Floats.   (line   6)
2352* Conversion functions:                  Rational Conversions.
2353                                                              (line   6)
2354* Copying conditions:                    Copying.             (line   6)
2355* CPPFLAGS:                              Build Options.       (line 206)
2356* CPU types <1>:                         Introduction to GMP. (line  24)
2357* CPU types:                             Build Options.       (line 108)
2358* Cross compiling:                       Build Options.       (line  66)
2359* Custom allocation:                     Custom Allocation.   (line   6)
2360* CXX:                                   Build Options.       (line 251)
2361* CXXFLAGS:                              Build Options.       (line 251)
2362* Cygwin:                                Notes for Particular Systems.
2363                                                              (line  43)
2364* Darwin:                                Known Build Problems.
2365                                                              (line  51)
2366* Debugging:                             Debugging.           (line   6)
2367* Demonstration programs:                Demonstration Programs.
2368                                                              (line   6)
2369* Digits in an integer:                  Miscellaneous Integer Functions.
2370                                                              (line  23)
2371* Divisibility algorithm:                Exact Remainder.     (line  30)
2372* Divisibility functions:                Integer Division.    (line 137)
2373* Divisibility testing:                  Efficiency.          (line  91)
2374* Division algorithms:                   Division Algorithms. (line   6)
2375* Division functions <1>:                Rational Arithmetic. (line  24)
2376* Division functions <2>:                Float Arithmetic.    (line  33)
2377* Division functions:                    Integer Division.    (line   6)
2378* DJGPP <1>:                             Notes for Particular Systems.
2379                                                              (line  43)
2380* DJGPP:                                 Known Build Problems.
2381                                                              (line  18)
2382* DLLs:                                  Notes for Particular Systems.
2383                                                              (line  56)
2384* DocBook:                               Build Options.       (line 347)
2385* Documentation formats:                 Build Options.       (line 340)
2386* Documentation license:                 GNU Free Documentation License.
2387                                                              (line   6)
2388* DVI:                                   Build Options.       (line 343)
2389* Efficiency:                            Efficiency.          (line   6)
2390* Emacs:                                 Emacs.               (line   6)
2391* Exact division functions:              Integer Division.    (line 112)
2392* Exact remainder:                       Exact Remainder.     (line   6)
2393* Example programs:                      Demonstration Programs.
2394                                                              (line   6)
2395* Exec prefix:                           Build Options.       (line  32)
2396* Execution profiling <1>:               Profiling.           (line   6)
2397* Execution profiling:                   Build Options.       (line 324)
2398* Exponentiation functions <1>:          Float Arithmetic.    (line  41)
2399* Exponentiation functions:              Integer Exponentiation.
2400                                                              (line   6)
2401* Export:                                Integer Import and Export.
2402                                                              (line  45)
2403* Expression parsing demo:               Demonstration Programs.
2404                                                              (line  18)
2405* Extended GCD:                          Number Theoretic Functions.
2406                                                              (line  49)
2407* Factor removal functions:              Number Theoretic Functions.
2408                                                              (line 108)
2409* Factorial algorithm:                   Factorial Algorithm. (line   6)
2410* Factorial functions:                   Number Theoretic Functions.
2411                                                              (line 116)
2412* Factorization demo:                    Demonstration Programs.
2413                                                              (line  25)
2414* Fast Fourier Transform:                FFT Multiplication.  (line   6)
2415* Fat binary:                            Build Options.       (line 162)
2416* FFT multiplication <1>:                Build Options.       (line 314)
2417* FFT multiplication:                    FFT Multiplication.  (line   6)
2418* Fibonacci number algorithm:            Fibonacci Numbers Algorithm.
2419                                                              (line   6)
2420* Fibonacci sequence functions:          Number Theoretic Functions.
2421                                                              (line 136)
2422* Float arithmetic functions:            Float Arithmetic.    (line   6)
2423* Float assignment functions <1>:        Simultaneous Float Init & Assign.
2424                                                              (line   6)
2425* Float assignment functions:            Assigning Floats.    (line   6)
2426* Float comparison functions:            Float Comparison.    (line   6)
2427* Float conversion functions:            Converting Floats.   (line   6)
2428* Float functions:                       Floating-point Functions.
2429                                                              (line   6)
2430* Float initialization functions <1>:    Simultaneous Float Init & Assign.
2431                                                              (line   6)
2432* Float initialization functions:        Initializing Floats. (line   6)
2433* Float input and output functions:      I/O of Floats.       (line   6)
2434* Float internals:                       Float Internals.     (line   6)
2435* Float miscellaneous functions:         Miscellaneous Float Functions.
2436                                                              (line   6)
2437* Float random number functions:         Miscellaneous Float Functions.
2438                                                              (line  27)
2439* Float rounding functions:              Miscellaneous Float Functions.
2440                                                              (line   9)
2441* Float sign tests:                      Float Comparison.    (line  35)
2442* Floating point mode:                   Notes for Particular Systems.
2443                                                              (line  34)
2444* Floating-point functions:              Floating-point Functions.
2445                                                              (line   6)
2446* Floating-point number:                 Nomenclature and Types.
2447                                                              (line  21)
2448* fnccheck:                              Profiling.           (line  77)
2449* Formatted input:                       Formatted Input.     (line   6)
2450* Formatted output:                      Formatted Output.    (line   6)
2451* Free Documentation License:            GNU Free Documentation License.
2452                                                              (line   6)
2453* frexp <1>:                             Converting Integers. (line  43)
2454* frexp:                                 Converting Floats.   (line  24)
2455* FTP of latest version:                 Introduction to GMP. (line  38)
2456* Function classes:                      Function Classes.    (line   6)
2457* FunctionCheck:                         Profiling.           (line  77)
2458* GCC Checker:                           Debugging.           (line 115)
2459* GCD algorithms:                        Greatest Common Divisor Algorithms.
2460                                                              (line   6)
2461* GCD extended:                          Number Theoretic Functions.
2462                                                              (line  49)
2463* GCD functions:                         Number Theoretic Functions.
2464                                                              (line  32)
2465* GDB:                                   Debugging.           (line  58)
2466* Generic C:                             Build Options.       (line 153)
2467* GMP Perl module:                       Demonstration Programs.
2468                                                              (line  35)
2469* GMP version number:                    Useful Macros and Constants.
2470                                                              (line  12)
2471* gmp.h:                                 Headers and Libraries.
2472                                                              (line   6)
2473* gmpxx.h:                               C++ Interface General.
2474                                                              (line   8)
2475* GNU Debugger:                          Debugging.           (line  58)
2476* GNU Free Documentation License:        GNU Free Documentation License.
2477                                                              (line   6)
2478* GNU strip:                             Known Build Problems.
2479                                                              (line  28)
2480* gprof:                                 Profiling.           (line  41)
2481* Greatest common divisor algorithms:    Greatest Common Divisor Algorithms.
2482                                                              (line   6)
2483* Greatest common divisor functions:     Number Theoretic Functions.
2484                                                              (line  32)
2485* Hardware floating point mode:          Notes for Particular Systems.
2486                                                              (line  34)
2487* Headers:                               Headers and Libraries.
2488                                                              (line   6)
2489* Heap problems:                         Debugging.           (line  24)
2490* Home page:                             Introduction to GMP. (line  34)
2491* Host system:                           Build Options.       (line  66)
2492* HP-UX:                                 ABI and ISA.         (line 107)
2493* HPPA:                                  ABI and ISA.         (line  68)
2494* I/O functions <1>:                     I/O of Floats.       (line   6)
2495* I/O functions <2>:                     I/O of Rationals.    (line   6)
2496* I/O functions:                         I/O of Integers.     (line   6)
2497* i386:                                  Notes for Particular Systems.
2498                                                              (line 127)
2499* IA-64:                                 ABI and ISA.         (line 107)
2500* Import:                                Integer Import and Export.
2501                                                              (line  11)
2502* In-place operations:                   Efficiency.          (line  57)
2503* Include files:                         Headers and Libraries.
2504                                                              (line   6)
2505* info-lookup-symbol:                    Emacs.               (line   6)
2506* Initialization functions <1>:          Simultaneous Float Init & Assign.
2507                                                              (line   6)
2508* Initialization functions <2>:          Random State Initialization.
2509                                                              (line   6)
2510* Initialization functions <3>:          Initializing Floats. (line   6)
2511* Initialization functions <4>:          Simultaneous Integer Init & Assign.
2512                                                              (line   6)
2513* Initialization functions <5>:          Initializing Rationals.
2514                                                              (line   6)
2515* Initialization functions:              Initializing Integers.
2516                                                              (line   6)
2517* Initializing and clearing:             Efficiency.          (line  21)
2518* Input functions <1>:                   I/O of Integers.     (line   6)
2519* Input functions <2>:                   I/O of Rationals.    (line   6)
2520* Input functions <3>:                   Formatted Input Functions.
2521                                                              (line   6)
2522* Input functions:                       I/O of Floats.       (line   6)
2523* Install prefix:                        Build Options.       (line  32)
2524* Installing GMP:                        Installing GMP.      (line   6)
2525* Instruction Set Architecture:          ABI and ISA.         (line   6)
2526* instrument-functions:                  Profiling.           (line  66)
2527* Integer:                               Nomenclature and Types.
2528                                                              (line   6)
2529* Integer arithmetic functions:          Integer Arithmetic.  (line   6)
2530* Integer assignment functions <1>:      Assigning Integers.  (line   6)
2531* Integer assignment functions:          Simultaneous Integer Init & Assign.
2532                                                              (line   6)
2533* Integer bit manipulation functions:    Integer Logic and Bit Fiddling.
2534                                                              (line   6)
2535* Integer comparison functions:          Integer Comparisons. (line   6)
2536* Integer conversion functions:          Converting Integers. (line   6)
2537* Integer division functions:            Integer Division.    (line   6)
2538* Integer exponentiation functions:      Integer Exponentiation.
2539                                                              (line   6)
2540* Integer export:                        Integer Import and Export.
2541                                                              (line  45)
2542* Integer functions:                     Integer Functions.   (line   6)
2543* Integer import:                        Integer Import and Export.
2544                                                              (line  11)
2545* Integer initialization functions <1>:  Simultaneous Integer Init & Assign.
2546                                                              (line   6)
2547* Integer initialization functions:      Initializing Integers.
2548                                                              (line   6)
2549* Integer input and output functions:    I/O of Integers.     (line   6)
2550* Integer internals:                     Integer Internals.   (line   6)
2551* Integer logical functions:             Integer Logic and Bit Fiddling.
2552                                                              (line   6)
2553* Integer miscellaneous functions:       Miscellaneous Integer Functions.
2554                                                              (line   6)
2555* Integer random number functions:       Integer Random Numbers.
2556                                                              (line   6)
2557* Integer root functions:                Integer Roots.       (line   6)
2558* Integer sign tests:                    Integer Comparisons. (line  28)
2559* Integer special functions:             Integer Special Functions.
2560                                                              (line   6)
2561* Interix:                               Notes for Particular Systems.
2562                                                              (line  51)
2563* Internals:                             Internals.           (line   6)
2564* Introduction:                          Introduction to GMP. (line   6)
2565* Inverse modulo functions:              Number Theoretic Functions.
2566                                                              (line  76)
2567* IRIX <1>:                              Known Build Problems.
2568                                                              (line  38)
2569* IRIX:                                  ABI and ISA.         (line 132)
2570* ISA:                                   ABI and ISA.         (line   6)
2571* istream input:                         C++ Formatted Input. (line   6)
2572* Jacobi symbol algorithm:               Jacobi Symbol.       (line   6)
2573* Jacobi symbol functions:               Number Theoretic Functions.
2574                                                              (line  83)
2575* Karatsuba multiplication:              Karatsuba Multiplication.
2576                                                              (line   6)
2577* Karatsuba square root algorithm:       Square Root Algorithm.
2578                                                              (line   6)
2579* Kronecker symbol functions:            Number Theoretic Functions.
2580                                                              (line  95)
2581* Language bindings:                     Language Bindings.   (line   6)
2582* Latest version of GMP:                 Introduction to GMP. (line  38)
2583* LCM functions:                         Number Theoretic Functions.
2584                                                              (line  70)
2585* Least common multiple functions:       Number Theoretic Functions.
2586                                                              (line  70)
2587* Legendre symbol functions:             Number Theoretic Functions.
2588                                                              (line  86)
2589* libgmp:                                Headers and Libraries.
2590                                                              (line  22)
2591* libgmpxx:                              Headers and Libraries.
2592                                                              (line  27)
2593* Libraries:                             Headers and Libraries.
2594                                                              (line  22)
2595* Libtool:                               Headers and Libraries.
2596                                                              (line  33)
2597* Libtool versioning:                    Notes for Package Builds.
2598                                                              (line   9)
2599* License conditions:                    Copying.             (line   6)
2600* Limb:                                  Nomenclature and Types.
2601                                                              (line  31)
2602* Limb size:                             Useful Macros and Constants.
2603                                                              (line   7)
2604* Linear congruential algorithm:         Random Number Algorithms.
2605                                                              (line  25)
2606* Linear congruential random numbers:    Random State Initialization.
2607                                                              (line  32)
2608* Linking:                               Headers and Libraries.
2609                                                              (line  22)
2610* Logical functions:                     Integer Logic and Bit Fiddling.
2611                                                              (line   6)
2612* Low-level functions:                   Low-level Functions. (line   6)
2613* Lucas number algorithm:                Lucas Numbers Algorithm.
2614                                                              (line   6)
2615* Lucas number functions:                Number Theoretic Functions.
2616                                                              (line 147)
2617* MacOS X:                               Known Build Problems.
2618                                                              (line  51)
2619* Mailing lists:                         Introduction to GMP. (line  45)
2620* Malloc debugger:                       Debugging.           (line  30)
2621* Malloc problems:                       Debugging.           (line  24)
2622* Memory allocation:                     Custom Allocation.   (line   6)
2623* Memory management:                     Memory Management.   (line   6)
2624* Mersenne twister algorithm:            Random Number Algorithms.
2625                                                              (line  17)
2626* Mersenne twister random numbers:       Random State Initialization.
2627                                                              (line  13)
2628* MINGW:                                 Notes for Particular Systems.
2629                                                              (line  43)
2630* MIPS:                                  ABI and ISA.         (line 132)
2631* Miscellaneous float functions:         Miscellaneous Float Functions.
2632                                                              (line   6)
2633* Miscellaneous integer functions:       Miscellaneous Integer Functions.
2634                                                              (line   6)
2635* MMX:                                   Notes for Particular Systems.
2636                                                              (line 133)
2637* Modular inverse functions:             Number Theoretic Functions.
2638                                                              (line  76)
2639* Most significant bit:                  Miscellaneous Integer Functions.
2640                                                              (line  34)
2641* MPN_PATH:                              Build Options.       (line 328)
2642* MS Windows:                            Notes for Particular Systems.
2643                                                              (line  43)
2644* MS-DOS:                                Notes for Particular Systems.
2645                                                              (line  43)
2646* Multi-threading:                       Reentrancy.          (line   6)
2647* Multiplication algorithms:             Multiplication Algorithms.
2648                                                              (line   6)
2649* Nails:                                 Low-level Functions. (line 485)
2650* Native compilation:                    Build Options.       (line  52)
2651* NeXT:                                  Known Build Problems.
2652                                                              (line  57)
2653* Next prime function:                   Number Theoretic Functions.
2654                                                              (line  25)
2655* Nomenclature:                          Nomenclature and Types.
2656                                                              (line   6)
2657* Non-Unix systems:                      Build Options.       (line  11)
2658* Nth root algorithm:                    Nth Root Algorithm.  (line   6)
2659* Number sequences:                      Efficiency.          (line 147)
2660* Number theoretic functions:            Number Theoretic Functions.
2661                                                              (line   6)
2662* Numerator and denominator:             Applying Integer Functions.
2663                                                              (line   6)
2664* obstack output:                        Formatted Output Functions.
2665                                                              (line  81)
2666* OpenBSD:                               Notes for Particular Systems.
2667                                                              (line  86)
2668* Optimizing performance:                Performance optimization.
2669                                                              (line   6)
2670* ostream output:                        C++ Formatted Output.
2671                                                              (line   6)
2672* Other languages:                       Language Bindings.   (line   6)
2673* Output functions <1>:                  Formatted Output Functions.
2674                                                              (line   6)
2675* Output functions <2>:                  I/O of Rationals.    (line   6)
2676* Output functions <3>:                  I/O of Floats.       (line   6)
2677* Output functions:                      I/O of Integers.     (line   6)
2678* Packaged builds:                       Notes for Package Builds.
2679                                                              (line   6)
2680* Parameter conventions:                 Parameter Conventions.
2681                                                              (line   6)
2682* Parsing expressions demo:              Demonstration Programs.
2683                                                              (line  15)
2684* Particular systems:                    Notes for Particular Systems.
2685                                                              (line   6)
2686* Past GMP versions:                     Compatibility with older versions.
2687                                                              (line   6)
2688* PDF:                                   Build Options.       (line 343)
2689* Perfect power algorithm:               Perfect Power Algorithm.
2690                                                              (line   6)
2691* Perfect power functions:               Integer Roots.       (line  28)
2692* Perfect square algorithm:              Perfect Square Algorithm.
2693                                                              (line   6)
2694* Perfect square functions:              Integer Roots.       (line  37)
2695* perl:                                  Demonstration Programs.
2696                                                              (line  35)
2697* Perl module:                           Demonstration Programs.
2698                                                              (line  35)
2699* Postscript:                            Build Options.       (line 343)
2700* Power/PowerPC <1>:                     Notes for Particular Systems.
2701                                                              (line  92)
2702* Power/PowerPC:                         Known Build Problems.
2703                                                              (line  63)
2704* Powering algorithms:                   Powering Algorithms. (line   6)
2705* Powering functions <1>:                Integer Exponentiation.
2706                                                              (line   6)
2707* Powering functions:                    Float Arithmetic.    (line  41)
2708* PowerPC:                               ABI and ISA.         (line 167)
2709* Precision of floats:                   Floating-point Functions.
2710                                                              (line   6)
2711* Precision of hardware floating point:  Notes for Particular Systems.
2712                                                              (line  34)
2713* Prefix:                                Build Options.       (line  32)
2714* Prime testing algorithms:              Prime Testing Algorithm.
2715                                                              (line   6)
2716* Prime testing functions:               Number Theoretic Functions.
2717                                                              (line   7)
2718* Primorial functions:                   Number Theoretic Functions.
2719                                                              (line 121)
2720* printf formatted output:               Formatted Output.    (line   6)
2721* Probable prime testing functions:      Number Theoretic Functions.
2722                                                              (line   7)
2723* prof:                                  Profiling.           (line  24)
2724* Profiling:                             Profiling.           (line   6)
2725* Radix conversion algorithms:           Radix Conversion Algorithms.
2726                                                              (line   6)
2727* Random number algorithms:              Random Number Algorithms.
2728                                                              (line   6)
2729* Random number functions <1>:           Miscellaneous Float Functions.
2730                                                              (line  27)
2731* Random number functions <2>:           Random Number Functions.
2732                                                              (line   6)
2733* Random number functions:               Integer Random Numbers.
2734                                                              (line   6)
2735* Random number seeding:                 Random State Seeding.
2736                                                              (line   6)
2737* Random number state:                   Random State Initialization.
2738                                                              (line   6)
2739* Random state:                          Nomenclature and Types.
2740                                                              (line  46)
2741* Rational arithmetic:                   Efficiency.          (line 113)
2742* Rational arithmetic functions:         Rational Arithmetic. (line   6)
2743* Rational assignment functions:         Initializing Rationals.
2744                                                              (line   6)
2745* Rational comparison functions:         Comparing Rationals. (line   6)
2746* Rational conversion functions:         Rational Conversions.
2747                                                              (line   6)
2748* Rational initialization functions:     Initializing Rationals.
2749                                                              (line   6)
2750* Rational input and output functions:   I/O of Rationals.    (line   6)
2751* Rational internals:                    Rational Internals.  (line   6)
2752* Rational number:                       Nomenclature and Types.
2753                                                              (line  16)
2754* Rational number functions:             Rational Number Functions.
2755                                                              (line   6)
2756* Rational numerator and denominator:    Applying Integer Functions.
2757                                                              (line   6)
2758* Rational sign tests:                   Comparing Rationals. (line  27)
2759* Raw output internals:                  Raw Output Internals.
2760                                                              (line   6)
2761* Reallocations:                         Efficiency.          (line  30)
2762* Reentrancy:                            Reentrancy.          (line   6)
2763* References:                            References.          (line   6)
2764* Remove factor functions:               Number Theoretic Functions.
2765                                                              (line 108)
2766* Reporting bugs:                        Reporting Bugs.      (line   6)
2767* Root extraction algorithm:             Nth Root Algorithm.  (line   6)
2768* Root extraction algorithms:            Root Extraction Algorithms.
2769                                                              (line   6)
2770* Root extraction functions <1>:         Integer Roots.       (line   6)
2771* Root extraction functions:             Float Arithmetic.    (line  37)
2772* Root testing functions:                Integer Roots.       (line  37)
2773* Rounding functions:                    Miscellaneous Float Functions.
2774                                                              (line   9)
2775* Sample programs:                       Demonstration Programs.
2776                                                              (line   6)
2777* Scan bit functions:                    Integer Logic and Bit Fiddling.
2778                                                              (line  40)
2779* scanf formatted input:                 Formatted Input.     (line   6)
2780* SCO:                                   Known Build Problems.
2781                                                              (line  38)
2782* Seeding random numbers:                Random State Seeding.
2783                                                              (line   6)
2784* Segmentation violation:                Debugging.           (line   7)
2785* Sequent Symmetry:                      Known Build Problems.
2786                                                              (line  68)
2787* Services for Unix:                     Notes for Particular Systems.
2788                                                              (line  51)
2789* Shared library versioning:             Notes for Package Builds.
2790                                                              (line   9)
2791* Sign tests <1>:                        Integer Comparisons. (line  28)
2792* Sign tests <2>:                        Comparing Rationals. (line  27)
2793* Sign tests:                            Float Comparison.    (line  35)
2794* Size in digits:                        Miscellaneous Integer Functions.
2795                                                              (line  23)
2796* Small operands:                        Efficiency.          (line   7)
2797* Solaris <1>:                           Known Build Problems.
2798                                                              (line  72)
2799* Solaris <2>:                           ABI and ISA.         (line 199)
2800* Solaris:                               Known Build Problems.
2801                                                              (line  78)
2802* Sparc:                                 Notes for Particular Systems.
2803                                                              (line 109)
2804* Sparc V9:                              ABI and ISA.         (line 199)
2805* Special integer functions:             Integer Special Functions.
2806                                                              (line   6)
2807* Square root algorithm:                 Square Root Algorithm.
2808                                                              (line   6)
2809* SSE2:                                  Notes for Particular Systems.
2810                                                              (line 133)
2811* Stack backtrace:                       Debugging.           (line  50)
2812* Stack overflow <1>:                    Build Options.       (line 275)
2813* Stack overflow:                        Debugging.           (line   7)
2814* Static linking:                        Efficiency.          (line  14)
2815* stdarg.h:                              Headers and Libraries.
2816                                                              (line  17)
2817* stdio.h:                               Headers and Libraries.
2818                                                              (line  11)
2819* Stripped libraries:                    Known Build Problems.
2820                                                              (line  28)
2821* Sun:                                   ABI and ISA.         (line 199)
2822* SunOS:                                 Notes for Particular Systems.
2823                                                              (line 121)
2824* Systems:                               Notes for Particular Systems.
2825                                                              (line   6)
2826* Temporary memory:                      Build Options.       (line 275)
2827* Texinfo:                               Build Options.       (line 340)
2828* Text input/output:                     Efficiency.          (line 153)
2829* Thread safety:                         Reentrancy.          (line   6)
2830* Toom multiplication <1>:               Other Multiplication.
2831                                                              (line   6)
2832* Toom multiplication <2>:               Toom 3-Way Multiplication.
2833                                                              (line   6)
2834* Toom multiplication <3>:               Higher degree Toom'n'half.
2835                                                              (line   6)
2836* Toom multiplication:                   Toom 4-Way Multiplication.
2837                                                              (line   6)
2838* Types:                                 Nomenclature and Types.
2839                                                              (line   6)
2840* ui and si functions:                   Efficiency.          (line  50)
2841* Unbalanced multiplication:             Unbalanced Multiplication.
2842                                                              (line   6)
2843* Upward compatibility:                  Compatibility with older versions.
2844                                                              (line   6)
2845* Useful macros and constants:           Useful Macros and Constants.
2846                                                              (line   6)
2847* User-defined precision:                Floating-point Functions.
2848                                                              (line   6)
2849* Valgrind:                              Debugging.           (line 130)
2850* Variable conventions:                  Variable Conventions.
2851                                                              (line   6)
2852* Version number:                        Useful Macros and Constants.
2853                                                              (line  12)
2854* Web page:                              Introduction to GMP. (line  34)
2855* Windows:                               Notes for Particular Systems.
2856                                                              (line  56)
2857* x86:                                   Notes for Particular Systems.
2858                                                              (line 127)
2859* x87:                                   Notes for Particular Systems.
2860                                                              (line  34)
2861* XML:                                   Build Options.       (line 347)
2862
2863
2864File: gmp.info,  Node: Function Index,  Prev: Concept Index,  Up: Top
2865
2866Function and Type Index
2867***********************
2868
2869�[index�]
2870* Menu:
2871
2872* __GMP_CC:                              Useful Macros and Constants.
2873                                                              (line  23)
2874* __GMP_CFLAGS:                          Useful Macros and Constants.
2875                                                              (line  24)
2876* __GNU_MP_VERSION:                      Useful Macros and Constants.
2877                                                              (line  10)
2878* __GNU_MP_VERSION_MINOR:                Useful Macros and Constants.
2879                                                              (line  11)
2880* __GNU_MP_VERSION_PATCHLEVEL:           Useful Macros and Constants.
2881                                                              (line  12)
2882* _mpz_realloc:                          Integer Special Functions.
2883                                                              (line  51)
2884* abs <1>:                               C++ Interface Rationals.
2885                                                              (line  49)
2886* abs <2>:                               C++ Interface Floats.
2887                                                              (line  83)
2888* abs:                                   C++ Interface Integers.
2889                                                              (line  47)
2890* ceil:                                  C++ Interface Floats.
2891                                                              (line  84)
2892* cmp <1>:                               C++ Interface Rationals.
2893                                                              (line  51)
2894* cmp <2>:                               C++ Interface Integers.
2895                                                              (line  49)
2896* cmp <3>:                               C++ Interface Rationals.
2897                                                              (line  50)
2898* cmp:                                   C++ Interface Floats.
2899                                                              (line  86)
2900* floor:                                 C++ Interface Floats.
2901                                                              (line  93)
2902* gmp_asprintf:                          Formatted Output Functions.
2903                                                              (line  65)
2904* gmp_errno:                             Random State Initialization.
2905                                                              (line  55)
2906* GMP_ERROR_INVALID_ARGUMENT:            Random State Initialization.
2907                                                              (line  55)
2908* GMP_ERROR_UNSUPPORTED_ARGUMENT:        Random State Initialization.
2909                                                              (line  55)
2910* gmp_fprintf:                           Formatted Output Functions.
2911                                                              (line  29)
2912* gmp_fscanf:                            Formatted Input Functions.
2913                                                              (line  25)
2914* GMP_LIMB_BITS:                         Low-level Functions. (line 515)
2915* GMP_NAIL_BITS:                         Low-level Functions. (line 513)
2916* GMP_NAIL_MASK:                         Low-level Functions. (line 523)
2917* GMP_NUMB_BITS:                         Low-level Functions. (line 514)
2918* GMP_NUMB_MASK:                         Low-level Functions. (line 524)
2919* GMP_NUMB_MAX:                          Low-level Functions. (line 532)
2920* gmp_obstack_printf:                    Formatted Output Functions.
2921                                                              (line  79)
2922* gmp_obstack_vprintf:                   Formatted Output Functions.
2923                                                              (line  81)
2924* gmp_printf:                            Formatted Output Functions.
2925                                                              (line  24)
2926* GMP_RAND_ALG_DEFAULT:                  Random State Initialization.
2927                                                              (line  49)
2928* GMP_RAND_ALG_LC:                       Random State Initialization.
2929                                                              (line  49)
2930* gmp_randclass:                         C++ Interface Random Numbers.
2931                                                              (line   7)
2932* gmp_randclass::get_f:                  C++ Interface Random Numbers.
2933                                                              (line  46)
2934* gmp_randclass::get_z_bits:             C++ Interface Random Numbers.
2935                                                              (line  38)
2936* gmp_randclass::get_z_range:            C++ Interface Random Numbers.
2937                                                              (line  42)
2938* gmp_randclass::gmp_randclass:          C++ Interface Random Numbers.
2939                                                              (line  13)
2940* gmp_randclass::seed:                   C++ Interface Random Numbers.
2941                                                              (line  33)
2942* gmp_randclear:                         Random State Initialization.
2943                                                              (line  62)
2944* gmp_randinit:                          Random State Initialization.
2945                                                              (line  47)
2946* gmp_randinit_default:                  Random State Initialization.
2947                                                              (line   7)
2948* gmp_randinit_lc_2exp:                  Random State Initialization.
2949                                                              (line  18)
2950* gmp_randinit_lc_2exp_size:             Random State Initialization.
2951                                                              (line  32)
2952* gmp_randinit_mt:                       Random State Initialization.
2953                                                              (line  13)
2954* gmp_randinit_set:                      Random State Initialization.
2955                                                              (line  43)
2956* gmp_randseed:                          Random State Seeding.
2957                                                              (line   8)
2958* gmp_randseed_ui:                       Random State Seeding.
2959                                                              (line  10)
2960* gmp_randstate_t:                       Nomenclature and Types.
2961                                                              (line  46)
2962* gmp_scanf:                             Formatted Input Functions.
2963                                                              (line  21)
2964* gmp_snprintf:                          Formatted Output Functions.
2965                                                              (line  46)
2966* gmp_sprintf:                           Formatted Output Functions.
2967                                                              (line  34)
2968* gmp_sscanf:                            Formatted Input Functions.
2969                                                              (line  29)
2970* gmp_urandomb_ui:                       Random State Miscellaneous.
2971                                                              (line   8)
2972* gmp_urandomm_ui:                       Random State Miscellaneous.
2973                                                              (line  14)
2974* gmp_vasprintf:                         Formatted Output Functions.
2975                                                              (line  66)
2976* gmp_version:                           Useful Macros and Constants.
2977                                                              (line  18)
2978* gmp_vfprintf:                          Formatted Output Functions.
2979                                                              (line  30)
2980* gmp_vfscanf:                           Formatted Input Functions.
2981                                                              (line  26)
2982* gmp_vprintf:                           Formatted Output Functions.
2983                                                              (line  25)
2984* gmp_vscanf:                            Formatted Input Functions.
2985                                                              (line  22)
2986* gmp_vsnprintf:                         Formatted Output Functions.
2987                                                              (line  48)
2988* gmp_vsprintf:                          Formatted Output Functions.
2989                                                              (line  35)
2990* gmp_vsscanf:                           Formatted Input Functions.
2991                                                              (line  31)
2992* hypot:                                 C++ Interface Floats.
2993                                                              (line  94)
2994* mp_bitcnt_t:                           Nomenclature and Types.
2995                                                              (line  42)
2996* mp_bits_per_limb:                      Useful Macros and Constants.
2997                                                              (line   7)
2998* mp_exp_t:                              Nomenclature and Types.
2999                                                              (line  27)
3000* mp_get_memory_functions:               Custom Allocation.   (line  90)
3001* mp_limb_t:                             Nomenclature and Types.
3002                                                              (line  31)
3003* mp_set_memory_functions:               Custom Allocation.   (line  18)
3004* mp_size_t:                             Nomenclature and Types.
3005                                                              (line  37)
3006* mpf_abs:                               Float Arithmetic.    (line  47)
3007* mpf_add:                               Float Arithmetic.    (line   7)
3008* mpf_add_ui:                            Float Arithmetic.    (line   9)
3009* mpf_ceil:                              Miscellaneous Float Functions.
3010                                                              (line   7)
3011* mpf_class:                             C++ Interface General.
3012                                                              (line  20)
3013* mpf_class::fits_sint_p:                C++ Interface Floats.
3014                                                              (line  87)
3015* mpf_class::fits_slong_p:               C++ Interface Floats.
3016                                                              (line  88)
3017* mpf_class::fits_sshort_p:              C++ Interface Floats.
3018                                                              (line  89)
3019* mpf_class::fits_uint_p:                C++ Interface Floats.
3020                                                              (line  90)
3021* mpf_class::fits_ulong_p:               C++ Interface Floats.
3022                                                              (line  91)
3023* mpf_class::fits_ushort_p:              C++ Interface Floats.
3024                                                              (line  92)
3025* mpf_class::get_d:                      C++ Interface Floats.
3026                                                              (line  95)
3027* mpf_class::get_mpf_t:                  C++ Interface General.
3028                                                              (line  66)
3029* mpf_class::get_prec:                   C++ Interface Floats.
3030                                                              (line 115)
3031* mpf_class::get_si:                     C++ Interface Floats.
3032                                                              (line  96)
3033* mpf_class::get_str:                    C++ Interface Floats.
3034                                                              (line  98)
3035* mpf_class::get_ui:                     C++ Interface Floats.
3036                                                              (line  99)
3037* mpf_class::mpf_class:                  C++ Interface Floats.
3038                                                              (line  12)
3039* mpf_class::operator=:                  C++ Interface Floats.
3040                                                              (line  60)
3041* mpf_class::set_prec:                   C++ Interface Floats.
3042                                                              (line 116)
3043* mpf_class::set_prec_raw:               C++ Interface Floats.
3044                                                              (line 117)
3045* mpf_class::set_str:                    C++ Interface Floats.
3046                                                              (line 101)
3047* mpf_class::swap:                       C++ Interface Floats.
3048                                                              (line 104)
3049* mpf_clear:                             Initializing Floats. (line  37)
3050* mpf_clears:                            Initializing Floats. (line  41)
3051* mpf_cmp:                               Float Comparison.    (line   7)
3052* mpf_cmp_d:                             Float Comparison.    (line   8)
3053* mpf_cmp_si:                            Float Comparison.    (line  10)
3054* mpf_cmp_ui:                            Float Comparison.    (line   9)
3055* mpf_div:                               Float Arithmetic.    (line  29)
3056* mpf_div_2exp:                          Float Arithmetic.    (line  55)
3057* mpf_div_ui:                            Float Arithmetic.    (line  33)
3058* mpf_eq:                                Float Comparison.    (line  18)
3059* mpf_fits_sint_p:                       Miscellaneous Float Functions.
3060                                                              (line  20)
3061* mpf_fits_slong_p:                      Miscellaneous Float Functions.
3062                                                              (line  18)
3063* mpf_fits_sshort_p:                     Miscellaneous Float Functions.
3064                                                              (line  22)
3065* mpf_fits_uint_p:                       Miscellaneous Float Functions.
3066                                                              (line  19)
3067* mpf_fits_ulong_p:                      Miscellaneous Float Functions.
3068                                                              (line  17)
3069* mpf_fits_ushort_p:                     Miscellaneous Float Functions.
3070                                                              (line  21)
3071* mpf_floor:                             Miscellaneous Float Functions.
3072                                                              (line   8)
3073* mpf_get_d:                             Converting Floats.   (line   7)
3074* mpf_get_d_2exp:                        Converting Floats.   (line  17)
3075* mpf_get_default_prec:                  Initializing Floats. (line  12)
3076* mpf_get_prec:                          Initializing Floats. (line  62)
3077* mpf_get_si:                            Converting Floats.   (line  28)
3078* mpf_get_str:                           Converting Floats.   (line  38)
3079* mpf_get_ui:                            Converting Floats.   (line  29)
3080* mpf_init:                              Initializing Floats. (line  19)
3081* mpf_init2:                             Initializing Floats. (line  26)
3082* mpf_init_set:                          Simultaneous Float Init & Assign.
3083                                                              (line  16)
3084* mpf_init_set_d:                        Simultaneous Float Init & Assign.
3085                                                              (line  19)
3086* mpf_init_set_si:                       Simultaneous Float Init & Assign.
3087                                                              (line  18)
3088* mpf_init_set_str:                      Simultaneous Float Init & Assign.
3089                                                              (line  26)
3090* mpf_init_set_ui:                       Simultaneous Float Init & Assign.
3091                                                              (line  17)
3092* mpf_inits:                             Initializing Floats. (line  31)
3093* mpf_inp_str:                           I/O of Floats.       (line  39)
3094* mpf_integer_p:                         Miscellaneous Float Functions.
3095                                                              (line  14)
3096* mpf_mul:                               Float Arithmetic.    (line  19)
3097* mpf_mul_2exp:                          Float Arithmetic.    (line  51)
3098* mpf_mul_ui:                            Float Arithmetic.    (line  21)
3099* mpf_neg:                               Float Arithmetic.    (line  44)
3100* mpf_out_str:                           I/O of Floats.       (line  19)
3101* mpf_pow_ui:                            Float Arithmetic.    (line  41)
3102* mpf_random2:                           Miscellaneous Float Functions.
3103                                                              (line  37)
3104* mpf_reldiff:                           Float Comparison.    (line  31)
3105* mpf_set:                               Assigning Floats.    (line  10)
3106* mpf_set_d:                             Assigning Floats.    (line  13)
3107* mpf_set_default_prec:                  Initializing Floats. (line   7)
3108* mpf_set_prec:                          Initializing Floats. (line  65)
3109* mpf_set_prec_raw:                      Initializing Floats. (line  72)
3110* mpf_set_q:                             Assigning Floats.    (line  15)
3111* mpf_set_si:                            Assigning Floats.    (line  12)
3112* mpf_set_str:                           Assigning Floats.    (line  18)
3113* mpf_set_ui:                            Assigning Floats.    (line  11)
3114* mpf_set_z:                             Assigning Floats.    (line  14)
3115* mpf_sgn:                               Float Comparison.    (line  35)
3116* mpf_sqrt:                              Float Arithmetic.    (line  36)
3117* mpf_sqrt_ui:                           Float Arithmetic.    (line  37)
3118* mpf_sub:                               Float Arithmetic.    (line  12)
3119* mpf_sub_ui:                            Float Arithmetic.    (line  16)
3120* mpf_swap:                              Assigning Floats.    (line  52)
3121* mpf_t:                                 Nomenclature and Types.
3122                                                              (line  21)
3123* mpf_trunc:                             Miscellaneous Float Functions.
3124                                                              (line   9)
3125* mpf_ui_div:                            Float Arithmetic.    (line  31)
3126* mpf_ui_sub:                            Float Arithmetic.    (line  14)
3127* mpf_urandomb:                          Miscellaneous Float Functions.
3128                                                              (line  27)
3129* mpn_add:                               Low-level Functions. (line  69)
3130* mpn_add_1:                             Low-level Functions. (line  64)
3131* mpn_add_n:                             Low-level Functions. (line  54)
3132* mpn_addmul_1:                          Low-level Functions. (line 148)
3133* mpn_and_n:                             Low-level Functions. (line 427)
3134* mpn_andn_n:                            Low-level Functions. (line 442)
3135* mpn_cmp:                               Low-level Functions. (line 284)
3136* mpn_com:                               Low-level Functions. (line 467)
3137* mpn_copyd:                             Low-level Functions. (line 476)
3138* mpn_copyi:                             Low-level Functions. (line 472)
3139* mpn_divexact_by3:                      Low-level Functions. (line 229)
3140* mpn_divexact_by3c:                     Low-level Functions. (line 231)
3141* mpn_divmod:                            Low-level Functions. (line 224)
3142* mpn_divmod_1:                          Low-level Functions. (line 208)
3143* mpn_divrem:                            Low-level Functions. (line 182)
3144* mpn_divrem_1:                          Low-level Functions. (line 206)
3145* mpn_gcd:                               Low-level Functions. (line 289)
3146* mpn_gcd_1:                             Low-level Functions. (line 299)
3147* mpn_gcdext:                            Low-level Functions. (line 305)
3148* mpn_get_str:                           Low-level Functions. (line 352)
3149* mpn_hamdist:                           Low-level Functions. (line 416)
3150* mpn_ior_n:                             Low-level Functions. (line 432)
3151* mpn_iorn_n:                            Low-level Functions. (line 447)
3152* mpn_lshift:                            Low-level Functions. (line 260)
3153* mpn_mod_1:                             Low-level Functions. (line 255)
3154* mpn_mul:                               Low-level Functions. (line 114)
3155* mpn_mul_1:                             Low-level Functions. (line 133)
3156* mpn_mul_n:                             Low-level Functions. (line 103)
3157* mpn_nand_n:                            Low-level Functions. (line 452)
3158* mpn_neg:                               Low-level Functions. (line  98)
3159* mpn_nior_n:                            Low-level Functions. (line 457)
3160* mpn_perfect_square_p:                  Low-level Functions. (line 422)
3161* mpn_popcount:                          Low-level Functions. (line 412)
3162* mpn_random:                            Low-level Functions. (line 401)
3163* mpn_random2:                           Low-level Functions. (line 402)
3164* mpn_rshift:                            Low-level Functions. (line 272)
3165* mpn_scan0:                             Low-level Functions. (line 386)
3166* mpn_scan1:                             Low-level Functions. (line 394)
3167* mpn_set_str:                           Low-level Functions. (line 367)
3168* mpn_sqr:                               Low-level Functions. (line 125)
3169* mpn_sqrtrem:                           Low-level Functions. (line 334)
3170* mpn_sub:                               Low-level Functions. (line  90)
3171* mpn_sub_1:                             Low-level Functions. (line  85)
3172* mpn_sub_n:                             Low-level Functions. (line  76)
3173* mpn_submul_1:                          Low-level Functions. (line 159)
3174* mpn_tdiv_qr:                           Low-level Functions. (line 171)
3175* mpn_xnor_n:                            Low-level Functions. (line 462)
3176* mpn_xor_n:                             Low-level Functions. (line 437)
3177* mpn_zero:                              Low-level Functions. (line 479)
3178* mpq_abs:                               Rational Arithmetic. (line  34)
3179* mpq_add:                               Rational Arithmetic. (line   8)
3180* mpq_canonicalize:                      Rational Number Functions.
3181                                                              (line  22)
3182* mpq_class:                             C++ Interface General.
3183                                                              (line  19)
3184* mpq_class::canonicalize:               C++ Interface Rationals.
3185                                                              (line  43)
3186* mpq_class::get_d:                      C++ Interface Rationals.
3187                                                              (line  52)
3188* mpq_class::get_den:                    C++ Interface Rationals.
3189                                                              (line  66)
3190* mpq_class::get_den_mpz_t:              C++ Interface Rationals.
3191                                                              (line  76)
3192* mpq_class::get_mpq_t:                  C++ Interface General.
3193                                                              (line  65)
3194* mpq_class::get_num:                    C++ Interface Rationals.
3195                                                              (line  65)
3196* mpq_class::get_num_mpz_t:              C++ Interface Rationals.
3197                                                              (line  75)
3198* mpq_class::get_str:                    C++ Interface Rationals.
3199                                                              (line  53)
3200* mpq_class::mpq_class:                  C++ Interface Rationals.
3201                                                              (line  23)
3202* mpq_class::set_str:                    C++ Interface Rationals.
3203                                                              (line  54)
3204* mpq_class::swap:                       C++ Interface Rationals.
3205                                                              (line  57)
3206* mpq_clear:                             Initializing Rationals.
3207                                                              (line  16)
3208* mpq_clears:                            Initializing Rationals.
3209                                                              (line  20)
3210* mpq_cmp:                               Comparing Rationals. (line   7)
3211* mpq_cmp_si:                            Comparing Rationals. (line  17)
3212* mpq_cmp_ui:                            Comparing Rationals. (line  15)
3213* mpq_denref:                            Applying Integer Functions.
3214                                                              (line  18)
3215* mpq_div:                               Rational Arithmetic. (line  24)
3216* mpq_div_2exp:                          Rational Arithmetic. (line  28)
3217* mpq_equal:                             Comparing Rationals. (line  33)
3218* mpq_get_d:                             Rational Conversions.
3219                                                              (line   7)
3220* mpq_get_den:                           Applying Integer Functions.
3221                                                              (line  24)
3222* mpq_get_num:                           Applying Integer Functions.
3223                                                              (line  23)
3224* mpq_get_str:                           Rational Conversions.
3225                                                              (line  22)
3226* mpq_init:                              Initializing Rationals.
3227                                                              (line   7)
3228* mpq_inits:                             Initializing Rationals.
3229                                                              (line  12)
3230* mpq_inp_str:                           I/O of Rationals.    (line  27)
3231* mpq_inv:                               Rational Arithmetic. (line  37)
3232* mpq_mul:                               Rational Arithmetic. (line  16)
3233* mpq_mul_2exp:                          Rational Arithmetic. (line  20)
3234* mpq_neg:                               Rational Arithmetic. (line  31)
3235* mpq_numref:                            Applying Integer Functions.
3236                                                              (line  17)
3237* mpq_out_str:                           I/O of Rationals.    (line  19)
3238* mpq_set:                               Initializing Rationals.
3239                                                              (line  24)
3240* mpq_set_d:                             Rational Conversions.
3241                                                              (line  17)
3242* mpq_set_den:                           Applying Integer Functions.
3243                                                              (line  26)
3244* mpq_set_f:                             Rational Conversions.
3245                                                              (line  18)
3246* mpq_set_num:                           Applying Integer Functions.
3247                                                              (line  25)
3248* mpq_set_si:                            Initializing Rationals.
3249                                                              (line  31)
3250* mpq_set_str:                           Initializing Rationals.
3251                                                              (line  36)
3252* mpq_set_ui:                            Initializing Rationals.
3253                                                              (line  29)
3254* mpq_set_z:                             Initializing Rationals.
3255                                                              (line  25)
3256* mpq_sgn:                               Comparing Rationals. (line  27)
3257* mpq_sub:                               Rational Arithmetic. (line  12)
3258* mpq_swap:                              Initializing Rationals.
3259                                                              (line  56)
3260* mpq_t:                                 Nomenclature and Types.
3261                                                              (line  16)
3262* mpz_2fac_ui:                           Number Theoretic Functions.
3263                                                              (line 114)
3264* mpz_abs:                               Integer Arithmetic.  (line  45)
3265* mpz_add:                               Integer Arithmetic.  (line   7)
3266* mpz_add_ui:                            Integer Arithmetic.  (line   9)
3267* mpz_addmul:                            Integer Arithmetic.  (line  26)
3268* mpz_addmul_ui:                         Integer Arithmetic.  (line  28)
3269* mpz_and:                               Integer Logic and Bit Fiddling.
3270                                                              (line  11)
3271* mpz_array_init:                        Integer Special Functions.
3272                                                              (line  11)
3273* mpz_bin_ui:                            Number Theoretic Functions.
3274                                                              (line 126)
3275* mpz_bin_uiui:                          Number Theoretic Functions.
3276                                                              (line 128)
3277* mpz_cdiv_q:                            Integer Division.    (line  13)
3278* mpz_cdiv_q_2exp:                       Integer Division.    (line  26)
3279* mpz_cdiv_q_ui:                         Integer Division.    (line  18)
3280* mpz_cdiv_qr:                           Integer Division.    (line  16)
3281* mpz_cdiv_qr_ui:                        Integer Division.    (line  22)
3282* mpz_cdiv_r:                            Integer Division.    (line  14)
3283* mpz_cdiv_r_2exp:                       Integer Division.    (line  28)
3284* mpz_cdiv_r_ui:                         Integer Division.    (line  20)
3285* mpz_cdiv_ui:                           Integer Division.    (line  24)
3286* mpz_class:                             C++ Interface General.
3287                                                              (line  18)
3288* mpz_class::fits_sint_p:                C++ Interface Integers.
3289                                                              (line  50)
3290* mpz_class::fits_slong_p:               C++ Interface Integers.
3291                                                              (line  51)
3292* mpz_class::fits_sshort_p:              C++ Interface Integers.
3293                                                              (line  52)
3294* mpz_class::fits_uint_p:                C++ Interface Integers.
3295                                                              (line  53)
3296* mpz_class::fits_ulong_p:               C++ Interface Integers.
3297                                                              (line  54)
3298* mpz_class::fits_ushort_p:              C++ Interface Integers.
3299                                                              (line  55)
3300* mpz_class::get_d:                      C++ Interface Integers.
3301                                                              (line  56)
3302* mpz_class::get_mpz_t:                  C++ Interface General.
3303                                                              (line  64)
3304* mpz_class::get_si:                     C++ Interface Integers.
3305                                                              (line  57)
3306* mpz_class::get_str:                    C++ Interface Integers.
3307                                                              (line  58)
3308* mpz_class::get_ui:                     C++ Interface Integers.
3309                                                              (line  59)
3310* mpz_class::mpz_class:                  C++ Interface Integers.
3311                                                              (line   7)
3312* mpz_class::set_str:                    C++ Interface Integers.
3313                                                              (line  60)
3314* mpz_class::swap:                       C++ Interface Integers.
3315                                                              (line  64)
3316* mpz_clear:                             Initializing Integers.
3317                                                              (line  49)
3318* mpz_clears:                            Initializing Integers.
3319                                                              (line  53)
3320* mpz_clrbit:                            Integer Logic and Bit Fiddling.
3321                                                              (line  56)
3322* mpz_cmp:                               Integer Comparisons. (line   7)
3323* mpz_cmp_d:                             Integer Comparisons. (line   8)
3324* mpz_cmp_si:                            Integer Comparisons. (line   9)
3325* mpz_cmp_ui:                            Integer Comparisons. (line  10)
3326* mpz_cmpabs:                            Integer Comparisons. (line  18)
3327* mpz_cmpabs_d:                          Integer Comparisons. (line  19)
3328* mpz_cmpabs_ui:                         Integer Comparisons. (line  20)
3329* mpz_com:                               Integer Logic and Bit Fiddling.
3330                                                              (line  20)
3331* mpz_combit:                            Integer Logic and Bit Fiddling.
3332                                                              (line  59)
3333* mpz_congruent_2exp_p:                  Integer Division.    (line 137)
3334* mpz_congruent_p:                       Integer Division.    (line 133)
3335* mpz_congruent_ui_p:                    Integer Division.    (line 135)
3336* mpz_divexact:                          Integer Division.    (line 110)
3337* mpz_divexact_ui:                       Integer Division.    (line 112)
3338* mpz_divisible_2exp_p:                  Integer Division.    (line 123)
3339* mpz_divisible_p:                       Integer Division.    (line 120)
3340* mpz_divisible_ui_p:                    Integer Division.    (line 122)
3341* mpz_even_p:                            Miscellaneous Integer Functions.
3342                                                              (line  18)
3343* mpz_export:                            Integer Import and Export.
3344                                                              (line  45)
3345* mpz_fac_ui:                            Number Theoretic Functions.
3346                                                              (line 113)
3347* mpz_fdiv_q:                            Integer Division.    (line  30)
3348* mpz_fdiv_q_2exp:                       Integer Division.    (line  43)
3349* mpz_fdiv_q_ui:                         Integer Division.    (line  35)
3350* mpz_fdiv_qr:                           Integer Division.    (line  33)
3351* mpz_fdiv_qr_ui:                        Integer Division.    (line  39)
3352* mpz_fdiv_r:                            Integer Division.    (line  31)
3353* mpz_fdiv_r_2exp:                       Integer Division.    (line  45)
3354* mpz_fdiv_r_ui:                         Integer Division.    (line  37)
3355* mpz_fdiv_ui:                           Integer Division.    (line  41)
3356* mpz_fib2_ui:                           Number Theoretic Functions.
3357                                                              (line 136)
3358* mpz_fib_ui:                            Number Theoretic Functions.
3359                                                              (line 134)
3360* mpz_fits_sint_p:                       Miscellaneous Integer Functions.
3361                                                              (line  10)
3362* mpz_fits_slong_p:                      Miscellaneous Integer Functions.
3363                                                              (line   8)
3364* mpz_fits_sshort_p:                     Miscellaneous Integer Functions.
3365                                                              (line  12)
3366* mpz_fits_uint_p:                       Miscellaneous Integer Functions.
3367                                                              (line   9)
3368* mpz_fits_ulong_p:                      Miscellaneous Integer Functions.
3369                                                              (line   7)
3370* mpz_fits_ushort_p:                     Miscellaneous Integer Functions.
3371                                                              (line  11)
3372* mpz_gcd:                               Number Theoretic Functions.
3373                                                              (line  32)
3374* mpz_gcd_ui:                            Number Theoretic Functions.
3375                                                              (line  39)
3376* mpz_gcdext:                            Number Theoretic Functions.
3377                                                              (line  49)
3378* mpz_get_d:                             Converting Integers. (line  27)
3379* mpz_get_d_2exp:                        Converting Integers. (line  36)
3380* mpz_get_si:                            Converting Integers. (line  18)
3381* mpz_get_str:                           Converting Integers. (line  47)
3382* mpz_get_ui:                            Converting Integers. (line  11)
3383* mpz_getlimbn:                          Integer Special Functions.
3384                                                              (line  60)
3385* mpz_hamdist:                           Integer Logic and Bit Fiddling.
3386                                                              (line  29)
3387* mpz_import:                            Integer Import and Export.
3388                                                              (line  11)
3389* mpz_init:                              Initializing Integers.
3390                                                              (line  26)
3391* mpz_init2:                             Initializing Integers.
3392                                                              (line  33)
3393* mpz_init_set:                          Simultaneous Integer Init & Assign.
3394                                                              (line  27)
3395* mpz_init_set_d:                        Simultaneous Integer Init & Assign.
3396                                                              (line  30)
3397* mpz_init_set_si:                       Simultaneous Integer Init & Assign.
3398                                                              (line  29)
3399* mpz_init_set_str:                      Simultaneous Integer Init & Assign.
3400                                                              (line  35)
3401* mpz_init_set_ui:                       Simultaneous Integer Init & Assign.
3402                                                              (line  28)
3403* mpz_inits:                             Initializing Integers.
3404                                                              (line  29)
3405* mpz_inp_raw:                           I/O of Integers.     (line  62)
3406* mpz_inp_str:                           I/O of Integers.     (line  31)
3407* mpz_invert:                            Number Theoretic Functions.
3408                                                              (line  76)
3409* mpz_ior:                               Integer Logic and Bit Fiddling.
3410                                                              (line  14)
3411* mpz_jacobi:                            Number Theoretic Functions.
3412                                                              (line  83)
3413* mpz_kronecker:                         Number Theoretic Functions.
3414                                                              (line  91)
3415* mpz_kronecker_si:                      Number Theoretic Functions.
3416                                                              (line  92)
3417* mpz_kronecker_ui:                      Number Theoretic Functions.
3418                                                              (line  93)
3419* mpz_lcm:                               Number Theoretic Functions.
3420                                                              (line  68)
3421* mpz_lcm_ui:                            Number Theoretic Functions.
3422                                                              (line  70)
3423* mpz_legendre:                          Number Theoretic Functions.
3424                                                              (line  86)
3425* mpz_lucnum2_ui:                        Number Theoretic Functions.
3426                                                              (line 147)
3427* mpz_lucnum_ui:                         Number Theoretic Functions.
3428                                                              (line 145)
3429* mpz_mfac_uiui:                         Number Theoretic Functions.
3430                                                              (line 116)
3431* mpz_mod:                               Integer Division.    (line 100)
3432* mpz_mod_ui:                            Integer Division.    (line 102)
3433* mpz_mul:                               Integer Arithmetic.  (line  19)
3434* mpz_mul_2exp:                          Integer Arithmetic.  (line  38)
3435* mpz_mul_si:                            Integer Arithmetic.  (line  20)
3436* mpz_mul_ui:                            Integer Arithmetic.  (line  22)
3437* mpz_neg:                               Integer Arithmetic.  (line  42)
3438* mpz_nextprime:                         Number Theoretic Functions.
3439                                                              (line  25)
3440* mpz_odd_p:                             Miscellaneous Integer Functions.
3441                                                              (line  17)
3442* mpz_out_raw:                           I/O of Integers.     (line  46)
3443* mpz_out_str:                           I/O of Integers.     (line  19)
3444* mpz_perfect_power_p:                   Integer Roots.       (line  28)
3445* mpz_perfect_square_p:                  Integer Roots.       (line  37)
3446* mpz_popcount:                          Integer Logic and Bit Fiddling.
3447                                                              (line  23)
3448* mpz_pow_ui:                            Integer Exponentiation.
3449                                                              (line  31)
3450* mpz_powm:                              Integer Exponentiation.
3451                                                              (line   8)
3452* mpz_powm_sec:                          Integer Exponentiation.
3453                                                              (line  18)
3454* mpz_powm_ui:                           Integer Exponentiation.
3455                                                              (line  10)
3456* mpz_primorial_ui:                      Number Theoretic Functions.
3457                                                              (line 121)
3458* mpz_probab_prime_p:                    Number Theoretic Functions.
3459                                                              (line   7)
3460* mpz_random:                            Integer Random Numbers.
3461                                                              (line  42)
3462* mpz_random2:                           Integer Random Numbers.
3463                                                              (line  51)
3464* mpz_realloc2:                          Initializing Integers.
3465                                                              (line  57)
3466* mpz_remove:                            Number Theoretic Functions.
3467                                                              (line 108)
3468* mpz_root:                              Integer Roots.       (line   8)
3469* mpz_rootrem:                           Integer Roots.       (line  14)
3470* mpz_rrandomb:                          Integer Random Numbers.
3471                                                              (line  31)
3472* mpz_scan0:                             Integer Logic and Bit Fiddling.
3473                                                              (line  38)
3474* mpz_scan1:                             Integer Logic and Bit Fiddling.
3475                                                              (line  40)
3476* mpz_set:                               Assigning Integers.  (line  10)
3477* mpz_set_d:                             Assigning Integers.  (line  13)
3478* mpz_set_f:                             Assigning Integers.  (line  15)
3479* mpz_set_q:                             Assigning Integers.  (line  14)
3480* mpz_set_si:                            Assigning Integers.  (line  12)
3481* mpz_set_str:                           Assigning Integers.  (line  21)
3482* mpz_set_ui:                            Assigning Integers.  (line  11)
3483* mpz_setbit:                            Integer Logic and Bit Fiddling.
3484                                                              (line  53)
3485* mpz_sgn:                               Integer Comparisons. (line  28)
3486* mpz_si_kronecker:                      Number Theoretic Functions.
3487                                                              (line  94)
3488* mpz_size:                              Integer Special Functions.
3489                                                              (line  68)
3490* mpz_sizeinbase:                        Miscellaneous Integer Functions.
3491                                                              (line  23)
3492* mpz_sqrt:                              Integer Roots.       (line  18)
3493* mpz_sqrtrem:                           Integer Roots.       (line  21)
3494* mpz_sub:                               Integer Arithmetic.  (line  12)
3495* mpz_sub_ui:                            Integer Arithmetic.  (line  14)
3496* mpz_submul:                            Integer Arithmetic.  (line  32)
3497* mpz_submul_ui:                         Integer Arithmetic.  (line  34)
3498* mpz_swap:                              Assigning Integers.  (line  37)
3499* mpz_t:                                 Nomenclature and Types.
3500                                                              (line   6)
3501* mpz_tdiv_q:                            Integer Division.    (line  47)
3502* mpz_tdiv_q_2exp:                       Integer Division.    (line  60)
3503* mpz_tdiv_q_ui:                         Integer Division.    (line  52)
3504* mpz_tdiv_qr:                           Integer Division.    (line  50)
3505* mpz_tdiv_qr_ui:                        Integer Division.    (line  56)
3506* mpz_tdiv_r:                            Integer Division.    (line  48)
3507* mpz_tdiv_r_2exp:                       Integer Division.    (line  62)
3508* mpz_tdiv_r_ui:                         Integer Division.    (line  54)
3509* mpz_tdiv_ui:                           Integer Division.    (line  58)
3510* mpz_tstbit:                            Integer Logic and Bit Fiddling.
3511                                                              (line  62)
3512* mpz_ui_kronecker:                      Number Theoretic Functions.
3513                                                              (line  95)
3514* mpz_ui_pow_ui:                         Integer Exponentiation.
3515                                                              (line  33)
3516* mpz_ui_sub:                            Integer Arithmetic.  (line  16)
3517* mpz_urandomb:                          Integer Random Numbers.
3518                                                              (line  14)
3519* mpz_urandomm:                          Integer Random Numbers.
3520                                                              (line  23)
3521* mpz_xor:                               Integer Logic and Bit Fiddling.
3522                                                              (line  17)
3523* operator"" <1>:                        C++ Interface Integers.
3524                                                              (line  30)
3525* operator"" <2>:                        C++ Interface Floats.
3526                                                              (line  56)
3527* operator"":                            C++ Interface Rationals.
3528                                                              (line  38)
3529* operator%:                             C++ Interface Integers.
3530                                                              (line  35)
3531* operator/:                             C++ Interface Integers.
3532                                                              (line  34)
3533* operator<<:                            C++ Formatted Output.
3534                                                              (line  20)
3535* operator>> <1>:                        C++ Interface Rationals.
3536                                                              (line  85)
3537* operator>>:                            C++ Formatted Input. (line  25)
3538* sgn <1>:                               C++ Interface Rationals.
3539                                                              (line  56)
3540* sgn <2>:                               C++ Interface Integers.
3541                                                              (line  62)
3542* sgn:                                   C++ Interface Floats.
3543                                                              (line 102)
3544* sqrt <1>:                              C++ Interface Integers.
3545                                                              (line  63)
3546* sqrt:                                  C++ Interface Floats.
3547                                                              (line 103)
3548* swap <1>:                              C++ Interface Floats.
3549                                                              (line 105)
3550* swap <2>:                              C++ Interface Integers.
3551                                                              (line  65)
3552* swap:                                  C++ Interface Rationals.
3553                                                              (line  58)
3554* trunc:                                 C++ Interface Floats.
3555                                                              (line 106)
3556
3557
3558
3559
3560Local Variables:
3561coding: iso-8859-1
3562End:
3563