Modern Computer Arithmetic

To cite this document, please use the following:

Modern Computer Arithmetic, Richard Brent and Paul Zimmermann, Cambridge University Press, 2010.

Preliminary versions of the book are available here:

Version 0.5.9 (October 2010), xvi+223 pages; this version corresponds quite closely to the version published by Cambridge University Press (the only differences being that pages i-viii slightly differ, and the three typos reported by Torbjörn Granlund on version 0.5.7 are fixed in 0.5.9).

Previous versions: Version 0.5.7 (September 2010), xvi+223 pages, Version 0.5.5 (September 2010), xvi+223 pages, Version 0.5.3 (August 2010), xvi+223 pages, Version 0.5.1 (March 2010), xvi+227 pages, Version 0.5 (February 2010), xvi+245 pages, Version 0.4 (November 2009), 239 pages, Version 0.3 (June 2009), 221 pages, Version 0.2.1 (March 2009), 215 pages, Version 0.2 (June 2008), 190 pages, Version 0.1.1 (November 2006), 94 pages, Version 0.1 (October 2006), 91 pages. For the electronic versions, copying this work is allowed for non-commercial use (see the license on page iii of the pdf file).

Abstract

for all operations (not just multiplication as many text books),

for all size ranges (not just schoolbook methods or FFT-based methods),

and including all details (for example how to properly deal with carries for integer algorithms, or a rigorous analysis of roundoff errors for floating-point algorithms).

Summary

Exercises

Errata

Errata for earlier versions of the book are here.

Software

fastfunlib is a C library for fast multiprecision evaluation of transcendental functions, using fixed-point arithmetic directly on top of GMP/MPIR. The goal is to provide optimized base implementations of transcendental functions, with minimal overhead at low precision as well as asymptotic speed.

Zen, from Reynald Lercier and Florent Chabaud, which provides fast arithmetic in polynomial finite rings over Z/nZ, with application to integer factorization and primality testing.

hgcd.c is an implementation of the binary (or 2-adic or LSB or right-to-left) subquadratic gcd from Stehlé and Zimmermann. It is quite efficient compared to the code in GMP 4.3.1 (which implements the classical MSB or left-to-right reduction). For example on a Core 2 at 2.83Ghz we can compute the GCD of two numbers of 107 limbs, i.e, about 193 million decimal digits, in 738.5s with mpz_gcd and 725.1s with mpz_bgcd . For 108 limbs, i.e., about 1.9 billion decimal digits, mpz_gcd takes 11776s and mpz_bgcd takes 11031s, thus a 6.3% speedup.

Books on Related Topics

Modern Computer Algebra , Joachim von zur Gathen and Jürgen Gerhard, Cambridge University Press, 2nd edition, 2003.

The Design and Analysis of Computer Algorithms, A. V. Aho, J. E. Hopcroft and J. D. Ullman, Addison-Wesley, 1974 [chapters 7 and 8].

The Computational Complexity of Algebraic and Numeric Problems, A. Borodin and I. Munro, Elsevier Computer Science Library, 1975.

Handbook of Applied Cryptography, Alfred J. Menezes, Paul C. van Oorschot and Scott A. Vanstone, CRC Press, 1997 [chapter 14].

Prime Numbers: A Computational Perspective, Richard E. Crandall and Carl Pomerance, Springer Verlag, 2001 [chapter 9].

Fast Algorithms, A Multitape Turing Machine Implementation, Arnold Schönhage and A. F. W. Grotefeld and E. Vetter, BI-Wissenschaftsverlag, 1994 [out of print].

Handbook of Elliptic and Hyperelliptic Curve Cryptography, Henri Cohen, Gerhard Frey, Roberto Avanzi, Christophe Doche, Tanja Lange, Kim Nguyen, Frederik Vercauteren, Chapman & Hall/CRC, series Discrete Mathematics and its Applications, 2005 [chapters 9-12].

Handbook of Floating-Point Arithmetic, Nicolas Brisebarre, Florent de Dinechin, Claude-Pierre Jeannerod, Vincent Lefèvre, Guillaume Melquiond, Jean-Michel Muller, Nathalie Revol, Damien Stehlé and Serge Torres, Birkhäuser, 2009.

Matters Computational, Jörg Arndt, Springer, 2010, also freely available online.

See also the ``Algorithms'' chapter from the GMP reference manual.

Reviews

Citations

31 December 2009: Fabrice Bellard set a new record for computing digits of Pi, with 2700 billion digits, and used our book for this record. See also his slides [in french]. His TPI executable code is freely available here.

1st August 2011: Richard Brent and David Harvey wrote a preprint Fast computation of Bernoulli, Tangent and Secant numbers which answers Exercises 4.35 to 4.41.

The FEE method of E. A. Karatsuba