# 任意精度算术

**任意精度算术**（大数算术）是指精度不由硬件字长固定、而是按需增长的计算，实践中仅受可用内存限制。它可作用于有符号整数、有理数和浮点数，与处理器内置的定宽整数类型和 IEEE 754 二进制浮点格式形成对照。<sup>[1](https://gmplib.org/)</sup><sup> • </sup><sup>[2](https://gmplib.org/gmp-man-6.3.0.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| “任意”的含义 | 精度仅受机器内存限制；GMP 的设计目标是通过根据操作数大小选择算法，在从几百位到数百万位的范围内都保持良好性能。<sup>[1](https://gmplib.org/)</sup><sup> • </sup><sup>[2](https://gmplib.org/gmp-man-6.3.0.pdf)</sup> |
| 内部表示 | 数字以定宽肢（32 位或 64 位字）数组存储，最低有效肢在前；64 位肢与原生乘法及进位指令相匹配。<sup>[3](https://www.hvks.com/Numerical/Downloads/HVE%20Fast%20arbitrary%20precision%20integer%20multiplication.pdf)</sup> |
| 乘法阶梯 | 随着操作数增大，GMP 使用七种算法：基本情况、Karatsuba、Toom-3、Toom-4、Toom-6.5、Toom-8.5 和 FFT，每种算法在超过可配置阈值后启用。<sup>[4](https://tspiteri.gitlab.io/gmp-mpfr-sys/dev/gmp_mpfr_sys/C/GMP/constant.Algorithms.html)</sup> |
| 渐近复杂度 | Karatsuba 为 O(N^1.585)，Toom-3 为 O(N^1.465)；理论最优的 O(n log n) 由 Harvey 和 van der Hoeven 于 2021 年达到，但尚未在实际中使用。<sup>[4](https://tspiteri.gitlab.io/gmp-mpfr-sys/dev/gmp_mpfr_sys/C/GMP/constant.Algorithms.html)</sup><sup> • </sup><sup>[5](https://www.texmacs.org/joris/nlogn/nlogn.pdf)</sup><sup> • </sup><sup>[6](https://rtca2023.github.io/pages_Paris/DocM4/Johansson.pdf)</sup> |
| 成本与硬件算术对比 | 解释型语言中的软件多精度运算可能比编译后的硬件算术慢数百到数千倍。<sup>[7](https://www.math.utah.edu/faq/mp/mp.html)</sup> |
| 记录级计算 | π 已被计算到 105,000,000,000,000 位（约 44 TB）；已知最大素数为 2^136,279,841 − 1，有 41,024,320 位，于 2024 年 10 月在服务器 GPU 上发现。<sup>[8](https://web.maths.unsw.edu.au/~davidharvey/talks/ankara2024.pdf)</sup><sup> • </sup><sup>[9](https://www.mersenne.org/primes/press/M136279841.html)</sup> |
| 密码学规模 | 前量子公钥密码学使用 256–4096 位整数的算术；RSA-2048 需要对 2048 位数进行模乘和模平方。<sup>[10](https://repositum.tuwien.at/bitstream/20.500.12708/226349/5/Ertl-2025-Multi-precision%20integer%20arithmetics-vor.pdf)</sup><sup> • </sup><sup>[11](https://cryptojedi.org/peter/teaching/mru2026/multiprecision.pdf)</sup> |

## 什么是任意精度算术

常见的 IEEE 754 浮点格式携带 24、53、64 或 113 位的有效数字，分别约合 7、15、19 和 34 个十进制数字。<sup>[7](https://www.math.utah.edu/faq/mp/mp.html)</sup> 大数库则随着数字增长为其分配存储空间。GNU 多精度算术库（GMP）声明，除运行机器的内存外，精度没有实际限制，并且其目标是通过根据操作数大小选择算法，在从几百位到数百万位的操作数上取得良好性能。<sup>[1](https://gmplib.org/)</sup><sup> • </sup><sup>[2](https://gmplib.org/gmp-man-6.3.0.pdf)</sup>

因此，“任意”意味着受内存约束，而非无限。

**何时需要它。** 双精度不够用的三种标准情形是：十进制与二进制基数之间的转换、正确舍入的初等函数，以及向量点积。<sup>[7](https://www.math.utah.edu/faq/mp/mp.html)</sup> 除此之外，任意精度还用于密码学、计算机代数和记录级常量的计算。<sup>[1](https://gmplib.org/)</sup>

## 大数如何表示

主流表示方式是肢的动态数组，每个肢是数字的一个定宽块，limbs[0] 为最低有效肢。64 位肢类型与原生字长匹配，使内层循环能够使用硬件指令进行乘法、带进位加法、带借位减法和移位。<sup>[3](https://www.hvks.com/Numerical/Downloads/HVE%20Fast%20arbitrary%20precision%20integer%20multiplication.pdf)</sup> 基于 GMP 的尾数存储，如 MPFR 和 Arb 中所用，采用相同格式：32 位或 64 位字的数组。优点是在从几位到数十亿位的精度范围内具有灵活性；缺点是簿记开销和向量化受限。<sup>[12](https://arxiv.org/html/1901.04289)</sup>

**内存行为。** 在 GMP 中，整数和有理数变量一旦增长便不会缩减已分配空间，从而避免频繁重新分配；浮点 mpf 变量使用初始化时设定的固定空间；除非配置了自定义分配，否则所有内存默认来自 malloc。<sup>[2](https://gmplib.org/gmp-man-6.3.0.pdf)</sup>

在中等精度（最多几百位）下，基于浮点向量构建的表示（如双-双精度和四-双精度算术）在现代硬件上凭借宽 SIMD 单元可以胜过基于肢的软件；对于最多 128 位的精度，一项基准测试显示球点积比基于肢的基线快达 4.2 倍。<sup>[12](https://arxiv.org/html/1901.04289)</sup>

## 核心乘法算法

大数乘法的算法史是一部指数递进史。长乘法的复杂度为 O(n^2)，其中 n 为数字位数；它在书面算术中可追溯至公元前 3000 年以前。Karatsuba 1962 年的算法通过将四次半尺寸乘法替换为三次，达到 O(n^1.58)。Toom 随后证明，对任意 ε > 0，乘法可在 O(N^(1+ε)) 内完成。Schönhage 和 Strassen 于 1971 年达到 O(n log n log log n)，Fürer 于 2007 年改进，Harvey 和 van der Hoeven 于 2021 年实现 O(n log n)，证实了 1971 年的猜想，其分析基于多带图灵机模型。<sup>[8](https://web.maths.unsw.edu.au/~davidharvey/talks/ankara2024.pdf)</sup><sup> • </sup><sup>[13](http://www.arxiv.org/abs/0801.1416)</sup><sup> • </sup><sup>[5](https://www.texmacs.org/joris/nlogn/nlogn.pdf)</sup>

**实用阶梯。** 随着 N 增大，GMP 用七种算法之一执行 N×N 肢乘法：基本情况、Karatsuba、Toom-3、Toom-4、Toom-6.5、Toom-8.5 和 FFT，每种在超过可配置阈值后选用。Karatsuba 的渐近复杂度为 O(N^1.585)，即指数 log(3)/log(2)，代表 3 次各为输入一半大小的乘法；Toom-3 为 O(N^1.465)，即 log(5)/log(3)，含 5 次各为三分之一大小的递归乘法。在大尺寸下，GMP 使用遵循 Schönhage 和 Strassen 的费马式 FFT。<sup>[4](https://tspiteri.gitlab.io/gmp-mpfr-sys/dev/gmp_mpfr_sys/C/GMP/constant.Algorithms.html)</sup> 一份实用综述给出的尺寸区间为：约 100 位以下用教科书式乘法，100–1,000 位用 Karatsuba，1,000–10,000 位用 Toom-Cook 变体，10,000 位以上用 FFT 或数论变换（NTT）方法，其中 Toom-Cook-3 为 O(n^1.46)，Toom-Cook-4 为 O(n^1.40)。<sup>[3](https://www.hvks.com/Numerical/Downloads/HVE%20Fast%20arbitrary%20precision%20integer%20multiplication.pdf)</sup> Karatsuba 对小操作数通常并不更快，切换点取决于寄存器大小、基数、相对运算成本和进位处理。<sup>[11](https://cryptojedi.org/peter/teaching/mru2026/multiprecision.pdf)</sup>

**来源分歧之处。** FFT 乘法在何种操作数大小上胜出，各家报告不一。GMP 自己的文档称其 FFT 阈值在 k=8 范围内，大约在 3,000 到 10,000 肢之间，按 64 位肢计约合 192,000 到 640,000 位。<sup>[4](https://tspiteri.gitlab.io/gmp-mpfr-sys/dev/gmp_mpfr_sys/C/GMP/constant.Algorithms.html)</sup> 另一份综述则称 GMP 的 Schönhage–Strassen 实现通常仅在数字超过 10,000–20,000 位时才启用。<sup>[3](https://www.hvks.com/Numerical/Downloads/HVE%20Fast%20arbitrary%20precision%20integer%20multiplication.pdf)</sup> 两种描述在位数上相差超过一个数量级。一个相关的实用要点是：使用浮点算术的 FFT 方法受舍入限制，而使用多个素数模并以中国剩余定理重构的 NTT 方法给出精确结果；FLINT 强调 NTT 方法。<sup>[3](https://www.hvks.com/Numerical/Downloads/HVE%20Fast%20arbitrary%20precision%20integer%20multiplication.pdf)</sup> Harvey 和 van der Hoeven 指出，Schönhage–Strassen 可能是世界上使用最广泛的大整数乘法算法，因为其经过优化的 GMP 实现是主要计算机代数系统大整数能力的基础；他们自己的 O(n log n) 算法尚未在实际中使用。<sup>[5](https://www.texmacs.org/joris/nlogn/nlogn.pdf)</sup><sup> • </sup><sup>[6](https://rtca2023.github.io/pages_Paris/DocM4/Johansson.pdf)</sup>

## 任意精度浮点

大整数和任意精度实数处理方式不同。实数携带尾数和指数，其精度是逐变量设置：MPFR 允许将每个变量的精度（以位计）精确设为任意有效值，包括非常小的精度。<sup>[14](https://www.mpfr.org/mpfr-4.2.0/mpfr.html)</sup>

**正确舍入。** MPFR 通过提供正确舍入和异常，将 IEEE 754 标准的思想扩展到任意精度，并为基本运算及更多运算提供 IEEE 754-1985 的四种舍入模式外加远离零舍入。<sup>[15](https://dl.acm.org/doi/10.1145/1236463.1236468)</sup><sup> • </sup><sup>[14](https://www.mpfr.org/mpfr-4.2.0/mpfr.html)</sup> 其结果不依赖于机器字长（mp_bits_per_limb，在多数当前处理器上为 64）、机器舍入模式或舍入精度，但忠实舍入情形可能例外，而这些强语义的实现相对于其他任意精度工具并无显著减速。<sup>[14](https://www.mpfr.org/mpfr-4.2.0/mpfr.html)</sup><sup> • </sup><sup>[15](https://dl.acm.org/doi/10.1145/1236463.1236468)</sup> 参考著作《现代计算机算术》（Brent 和 Zimmermann）汇集了整数、模 n 整数和浮点数的前沿算法，包括严格的舍入误差分析。<sup>[16](https://maths-people.anu.edu.au/~brent/pub/pub226.html)</sup>

## 用数字说话

**交叉点与成本。** 某一实现的基准测试显示：64 位线性卷积在约 4,000 个十进制数字以下最快，优化的基-2 FFT 随后接管并延伸至超过 100 万位，Toom-Cook-3 在 10,000 位以上略快于 Karatsuba。<sup>[3](https://www.hvks.com/Numerical/Downloads/HVE%20Fast%20arbitrary%20precision%20integer%20multiplication.pdf)</sup> GMP 的分治除法渐近复杂度为 O(M(N)·log N)，实践中在中等至大尺寸下，2N×N 除法比 N×N 乘法慢约 2 到 4 倍。<sup>[4](https://tspiteri.gitlab.io/gmp-mpfr-sys/dev/gmp_mpfr_sys/C/GMP/constant.Algorithms.html)</sup> 在 FFT 模型中，实际除法成本约为 1.666·M(n)，平方根约为 1.333·M(n)，其中 M(n) 为乘法成本；乘法在基本情况范围内接近 M(n)，在 FFT 范围内约为 2M(n) 到 3M(n)。<sup>[6](https://rtca2023.github.io/pages_Paris/DocM4/Johansson.pdf)</sup>

**解释型语言的开销。** 解释型语言中的软件多精度算术可能比编译后的硬件算术慢数百到数千倍。<sup>[7](https://www.math.utah.edu/faq/mp/mp.html)</sup> 在 3.16 GHz Core 2 Duo 上的一项十进制基准测试展示了差距：在 9 位精度下，C 实现的 cdecimal 耗时 0.27 秒，而 Python 纯 Python decimal 模块耗时 17.61 秒，原生浮点数为 0.12 秒；在 100 位精度下，cdecimal 耗时 4.52 秒，而 Java BigDecimal 耗时 5.35 秒。<sup>[17](https://www.bytereef.org/mpdecimal/benchmarks.html)</sup>

**记录。** 一份 2024 年的来源报告称 π 计算记录为 105,000,000,000,000 位，约 44 TB，并指出自 2010 年以来的所有记录都使用了 Alexander Yee 的 y-cruncher 程序。<sup>[8](https://web.maths.unsw.edu.au/~davidharvey/talks/ankara2024.pdf)</sup> 过去 30 年大多数 π 记录使用 Chudnovsky 级数，配合二进制分裂成本为 O(M(n)·log² n)。<sup>[6](https://rtca2023.github.io/pages_Paris/DocM4/Johansson.pdf)</sup> Brent 以及独立的 Salamin 于 1975 年证明，π 的前 n 位可在 O(M(n)·log n) 时间内计算。<sup>[8](https://web.maths.unsw.edu.au/~davidharvey/talks/ankara2024.pdf)</sup> 迄今最大的公开分解为 250 个十进制位，约 829 个二进制位，于 2020 年 2 月用通用数域筛法完成，耗费约 2,700 CPU 年；当前推荐的 RSA 密钥长度为 2048 位，约 616 个十进制数字。<sup>[8](https://web.maths.unsw.edu.au/~davidharvey/talks/ankara2024.pdf)</sup>

## 实现与语言支持

**GMP** 是一个可移植的 C 库，由 Torbjörn Granlund 于 1991 年首次发布，与早期的 Berkeley MP 库大体兼容但效率高得多；其 v1.1 文档声称对小操作数的速度是 Berkeley MP 的 5 到 100 倍。<sup>[18](https://shoup.net/papers/akl-chapter.pdf)</sup><sup> • </sup><sup>[1](https://gmplib.org/)</sup> 其速度来源于使用全字作为基本算术类型、快速算法，以及针对许多 CPU 上最常见内层循环的高度优化汇编代码；GMP 6.3.0 在 930 个文件中包含 155,715 行汇编，在 Debian 12 中，65,523 个包中有 1,839 个（2.8%）依赖它。<sup>[1](https://gmplib.org/)</sup><sup> • </sup><sup>[10](https://repositum.tuwien.at/bitstream/20.500.12708/226349/5/Ertl-2025-Multi-precision%20integer%20arithmetics-vor.pdf)</sup> 当前稳定版本为 6.3.0，发布于 2023-07-30，新项目被引导使用 MPFR 而非 GMP 较旧的 mpf 浮点层。<sup>[19](https://www.gnu.org/software/gmp/)</sup>

**MPFR** 是一个基于 GMP 的任意精度浮点算术可移植 C 库，版本 4.2.2 日期为 2025 年 3 月，提供上述正确舍入语义。<sup>[20](https://www.mpfr.org/mpfr-current/mpfr.pdf)</sup> 在二进制多精度基准测试中，MPFR 在纯计算时间上领先，但当结果必须转换为十进制时，libmpdec 和 apfloat 更快。<sup>[17](https://www.bytereef.org/mpdecimal/benchmarks.html)</sup>

**其他库。** NTL 于 2000 年重构，使用 GMP 而非 LIP 库进行长整数算术；LIP 曾为广泛分布的整数分解项目设计，可移植性是其重要设计特征。在配备 GMP 6.1.0 的 Intel Xeon E5-2698 v3 上，GMP 将两个 1,000 位整数相乘比 NTL 的原生实现快 3 到 4 倍，比 LIP 的原始技术快 8 倍；NTL 的原生代码使用 Karatsuba，而 GMP 增加了包括 FFT 在内的更多算法。<sup>[18](https://shoup.net/papers/akl-chapter.pdf)</sup> FLINT 强调基于 NTT 的多素数模乘法。<sup>[3](https://www.hvks.com/Numerical/Downloads/HVE%20Fast%20arbitrary%20precision%20integer%20multiplication.pdf)</sup> 在 Python 中，mpmath 在 10 位或 1,000 位精度下进行实数和复数计算，默认使用 Python 内置长整数，并在安装了 gmpy2 后通过它自动切换到 GMP 以获得更快的高精度算术。<sup>[21](https://www.mpmath.org/)</sup> Boost.Multiprecision 提供 C++ 数值类型，其精度可任意大（受内存限制）、在编译时固定（例如 50 或 100 个十进制数字），或在运行时可变。<sup>[22](https://www.boost.org/library/1.88.0/multiprecision/)</sup>

## 应用：密码学与计算数学

非对称密码学严重依赖大整数算术：RSA-2048 需要对 2048 位数进行模乘和模平方，前量子公钥密码学一般使用 256 到 4,096 位的规模。<sup>[11](https://cryptojedi.org/peter/teaching/mru2026/multiprecision.pdf)</sup><sup> • </sup><sup>[10](https://repositum.tuwien.at/bitstream/20.500.12708/226349/5/Ertl-2025-Multi-precision%20integer%20arithmetics-vor.pdf)</sup> GMP 将密码学应用与研究、互联网安全应用、代数系统和计算代数研究列为其主要目标应用。<sup>[1](https://gmplib.org/)</sup> 分解能力与密钥长度之间的差距是具体的：最大公开分解为 829 位，而推荐密钥为 2,048 位。<sup>[8](https://web.maths.unsw.edu.au/~davidharvey/talks/ankara2024.pdf)</sup>

快速乘法也服务于纯数学：计算 π 的各位数字、搜索 Wilson 素数，以及计算代数簇的 zeta 函数。<sup>[8](https://web.maths.unsw.edu.au/~davidharvey/talks/ankara2024.pdf)</sup>

## 历史

算法故事从教科书式乘法，历经 Karatsuba（1962）、Toom 的 O(N^(1+ε)) 结果、Schönhage–Strassen（1971）、Fürer（2007），到 Harvey–van der Hoeven 的 O(n log n)（2021）。<sup>[8](https://web.maths.unsw.edu.au/~davidharvey/talks/ankara2024.pdf)</sup><sup> • </sup><sup>[13](http://www.arxiv.org/abs/0801.1416)</sup> 采用滞后于理论：1980 年美国国家标准局（NBS）的一份报告观察到，低阶乘法算法尚未进入通用多精度包，因为在出现实际节省之前需要过大的 n 值；Brent 在 UNIVAC 1108 上的包在 n = 10（约 43 个十进制位）时乘法耗时约 2 毫秒。<sup>[23](https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nbsir80-2138.pdf)</sup> 同时代的 DEC BigNum 包明确追求可移植性与速度：用原生汇编重写的小内核使包变快，因为编译的高级语言算术通常比手写机器代码慢 4 到 10 倍；BigNum 成为 LeLisp 和 Modula2+ 中算术的基础。<sup>[24](http://bitsavers.trailing-edge.com/pdf/dec/tech_reports/PRL-RR-2.pdf)</sup> GMP 1991 年的发布巩固了这种汇编调优内核加尺寸自适应算法的方法，此后大约每年发布一个新版本。<sup>[18](https://shoup.net/papers/akl-chapter.pdf)</sup><sup> • </sup><sup>[1](https://gmplib.org/)</sup>

## 近期进展

最明显的变化在记录级计算的硬件上。2024 年 10 月 12 日，GIMPS 宣布第 52 个已知梅森素数 2^136,279,841 − 1，有 41,024,320 个十进制数字，由 Luke Durant 发现；它比前纪录素数多出超过 1,600 万位。<sup>[9](https://www.mersenne.org/primes/press/M136279841.html)</sup> Durant 的云超级计算机由数千个服务器 GPU 组成，横跨 17 个国家的 24 个数据中心区域；都柏林的一台 NVIDIA A100 于 10 月 11 日报告该数可能为素数，圣安东尼奥的一台 NVIDIA H100 于 10 月 12 日用 Lucas-Lehmer 测试确认了素性。<sup>[9](https://www.mersenne.org/primes/press/M136279841.html)</sup> GIMPS 成立于 1996 年，已发现最近 18 个梅森素数，Mihai Preda 2017 年的 GpuOwl 程序终结了普通个人计算机发现这些素数的 28 年统治。<sup>[9](https://www.mersenne.org/primes/press/M136279841.html)</sup> 首个一亿位素数和十亿位素数分别悬赏 150,000 美元和 250,000 美元。<sup>[25](https://www.smithsonianmag.com/smart-news/amateur-mathematician-discovers-the-largest-known-prime-number-with-more-than-41-million-digits-180985321/)</sup>

软件方面，GMP 6.3.0（2023 年 7 月）仍是当前稳定版本，MPFR 为 4.2.2 版（2025 年 3 月）；105 万亿位的 π 记录由 y-cruncher 创造，延续了记录级计算在大型多核和 GPU 支持系统上运行的趋势。<sup>[19](https://www.gnu.org/software/gmp/)</sup><sup> • </sup><sup>[20](https://www.mpfr.org/mpfr-current/mpfr.pdf)</sup><sup> • </sup><sup>[8](https://web.maths.unsw.edu.au/~davidharvey/talks/ankara2024.pdf)</sup>

## References

1. [The GNU MP Bignum Library, gmplib.org](https://gmplib.org/)
2. [GNU MP 6.3.0 Manual (PDF)](https://gmplib.org/gmp-man-6.3.0.pdf)
3. [HVE: Fast Arbitrary Precision Integer Multiplication](https://www.hvks.com/Numerical/Downloads/HVE%20Fast%20arbitrary%20precision%20integer%20multiplication.pdf)
4. [Algorithms (GMP algorithms chapter, gmp-mpfr-sys documentation)](https://tspiteri.gitlab.io/gmp-mpfr-sys/dev/gmp_mpfr_sys/C/GMP/constant.Algorithms.html)
5. [Harvey & van der Hoeven, Integer multiplication in time O(n log n)](https://www.texmacs.org/joris/nlogn/nlogn.pdf)
6. [Johansson, The practical complexity of arbitrary-precision functions](https://rtca2023.github.io/pages_Paris/DocM4/Johansson.pdf)
7. [University of Utah Mathematics FAQ: Multiple-precision arithmetic](https://www.math.utah.edu/faq/mp/mp.html)
8. [Harvey, Integer multiplication and its applications (Ankara 2024 talk)](https://web.maths.unsw.edu.au/~davidharvey/talks/ankara2024.pdf)
9. [GIMPS Discovers Largest Known Prime Number: 2^136,279,841−1](https://www.mersenne.org/primes/press/M136279841.html)
10. [Ertl, Multi-precision integer arithmetics (TU Wien, 2025)](https://repositum.tuwien.at/bitstream/20.500.12708/226349/5/Ertl-2025-Multi-precision%20integer%20arithmetics-vor.pdf)
11. [Engineering Cryptographic Software — Multiprecision Arithmetic (lecture slides)](https://cryptojedi.org/peter/teaching/mru2026/multiprecision.pdf)
12. [Faster arbitrary-precision dot product and matrix multiplication (arXiv)](https://arxiv.org/html/1901.04289)
13. [Harvey, Fast Integer Multiplication Using Modular Arithmetic (arXiv)](http://www.arxiv.org/abs/0801.1416)
14. [GNU MPFR 4.2.0 manual](https://www.mpfr.org/mpfr-4.2.0/mpfr.html)
15. [MPFR: A multiple-precision binary floating-point library with correct rounding, ACM TOMS](https://dl.acm.org/doi/10.1145/1236463.1236468)
16. [Brent & Zimmermann, Modern Computer Arithmetic, book page](https://maths-people.anu.edu.au/~brent/pub/pub226.html)
17. [Decimal Arithmetic Benchmarks, mpdecimal project](https://www.bytereef.org/mpdecimal/benchmarks.html)
18. [Shoup, Libraries (chapter on NTL, LIP, and GMP history)](https://shoup.net/papers/akl-chapter.pdf)
19. [The GNU MP Bignum Library, gnu.org](https://www.gnu.org/software/gmp/)
20. [The Multiple Precision Floating-Point Reliable Library, Edition 4.2.2 (PDF)](https://www.mpfr.org/mpfr-current/mpfr.pdf)
21. [mpmath documentation](https://www.mpmath.org/)
22. [Boost.Multiprecision documentation](https://www.boost.org/library/1.88.0/multiprecision/)
23. [Multiprecision computing at NBS (NBS report, 1980)](https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nbsir80-2138.pdf)
24. [BigNum: A Portable and Efficient Package for Arbitrary-Precision Arithmetic (DEC PRL)](http://bitsavers.trailing-edge.com/pdf/dec/tech_reports/PRL-RR-2.pdf)
25. [Amateur Mathematician Discovers the Largest Known Prime Number, Smithsonian Magazine](https://www.smithsonianmag.com/smart-news/amateur-mathematician-discovers-the-largest-known-prime-number-with-more-than-41-million-digits-180985321/)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Arithmetic and number systems › Computational arithmetic › Arbitrary-precision arithmetic

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/arbitrary-precision-arithmetic

English original: https://www.edgepedia.org/arbitrary-precision-arithmetic
