Math 2.0

Numerical analysis Definition

Arbitrary-precision arithmetic

Builds on IntegersFloating-point arithmetic

Definition

Fix an integer base B≥2B \ge 2, in practice a power of 22 such as 2642^{64}. In arbitrary-precision arithmetic an integer aa is stored as a sign and a list of digits (a0,…,ak−1)(a_0, \ldots, a_{k-1}). Here 0≤ai<B0 \le a_i < B and ∣a∣=∑i=0k−1aiBi,\abs{a} = \sum_{i=0}^{k-1} a_i B^i, where the length kk is not fixed in advance and grows as needed. Arithmetic operations on such lists return the exact integer result in the same form. Rational numbers are stored as pairs of such integers. Real numbers are stored as floating-point numbers m⋅2em \cdot 2^{e}, where mm and ee are such integers and the precision pp is chosen by the user.

Remarks

Example: with B=10B = 10, the integer 123456780123456780 is the list (0,8,7,6,5,4,3,2,1)(0, 8, 7, 6, 5, 4, 3, 2, 1); adding 11 changes only a0a_0, while adding 999999999999999999 produces a list of length 1010. Non-example: IEEE binary64 arithmetic is not arbitrary-precision; its precision is fixed at 5353 bits, so 253+12^{53} + 1 cannot be stored exactly. Addition of two kk-digit numbers costs O(k)O(k) digit operations, schoolbook multiplication costs O(k2)O(k^2), and Karatsuba multiplication costs O(klog⁡23)O(k^{\log_2 3}).

Reading path

To understand this page from the ground up, read these 3 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Floating-point arithmetic concept
  2. Integers object
  3. Arbitrary-precision arithmetic definition

Further reading

  1. Web https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic
About this page
Tag8Y4C6N09YQ
URIm2://8Y4C6N09YQ
Kinddefinition
WritingW0 stub
MSC65Y04, 68W30
DefinesArbitrary-precision arithmetic
UsesIntegers, Floating-point arithmetic

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • an inventory row: the row of the inventory that the node accounts for (0 of 1)
  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.