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