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