# 有效数字算术

**有效数字算术**（Significance arithmetic）是一种面向近似数值的计算机算术形式，它不仅计算结果，还利用误差传播来追踪结果的准确度，从而使一次计算返回一个数值以及一个估计的（或最坏情况的）不确定度<sup>[1](https://mathworld.wolfram.com/SignificanceArithmetic.html)</sup>。普通浮点算术为每个操作数固定携带的数字位数，而有效数字算术系统则动态调整每次运算所使用的位数，并且只报告它判定为可靠的数字<sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup>。最知名的生产级实现是 Wolfram 语言（Mathematica）的任意精度算术<sup>[1](https://mathworld.wolfram.com/SignificanceArithmetic.html)</sup>。

| 关键事实 | 详情 |
|---|---|
| 定义 | 一种近似量的算术，在计算过程中携带准确度和精度信息，返回结果及其估计的或最坏情况的不确定度<sup>[1](https://mathworld.wolfram.com/SignificanceArithmetic.html)</sup> |
| 起源 | 20 世纪 60 年代由阿舍赫斯特（Ashenhurst）、梅特罗波利斯（Metropolis）等人作为自动误差分析的一种形式加以研究；其思想可追溯至 20 世纪 50 年代末<sup>[3](https://pages.stat.wisc.edu/~bwu62/771/hingham2002.pdf)</sup><sup> • </sup><sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup> |
| 误差模型 | 数值 x 带绝对不确定度 dx 时，其精度为 \( -\log_{10}(dx/x) \)；乘积将相对误差按一阶组合，\( \mathrm{Precision}[x \cdot y] = -\log_{10}(10^{-\mathrm{Precision}[x]} + 10^{-\mathrm{Precision}[y]}) \)<sup>[4](https://reference.wolfram.com/language/ref/Precision.html.en?source=footer)</sup><sup> • </sup><sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup> |
| 保证 | 与区间算术不同，误差界是近似的，而非有保证的包络；作为交换，有效数字算术适用于更广泛的问题<sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup> |
| 主要实现 | Mathematica 的任意精度算术，自 1.0 版（1988 年）起即已存在，输入精度使用反引号记法 `digits\`p`<sup>[5](https://www.conradwolfram.com/writings/2016/7/8/how-significant-is-significance)</sup><sup> • </sup><sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup> |
| 已知弱点 | 操作数之间的误差相关性可能违反误差模型所依赖的独立性假设<sup>[6](https://forums.wolfram.com/mathgroup/archive/2000/Jun/msg00316.html)</sup> |

## 工作原理

有效数字算术系统为每个近似数附加一个度量，表示其中有多少是可信的。在 Wolfram 语言的表述中，精度（Precision）度量相对不确定度，准确度（Accuracy）度量绝对不确定度：对于带绝对不确定度 dx 的数值 x，\( \mathrm{Precision}[x] = -\log_{10}(dx/x) \)，大致等于正确的有效数字位数；而 Accuracy 则计算小数点之后的正确位数<sup>[4](https://reference.wolfram.com/language/ref/Precision.html.en?source=footer)</sup>。整数等精确数具有无穷精度<sup>[4](https://reference.wolfram.com/language/ref/Precision.html.en?source=footer)</sup>。

随后每次运算都会传播这些度量。对于已知绝对误差的实数 x 与 y 的加法，和的准确度计算为

\[ \mathrm{Accuracy}[x + y] = -\log_{10}\left(10^{-\mathrm{Accuracy}[x]} + 10^{-\mathrm{Accuracy}[y]}\right), \]

这相当于将两个绝对误差区间相加<sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup>。对于乘法，系统将每个操作数写为区间 \( [x(1-\varepsilon_x),\, x(1+\varepsilon_x)] \)，其相对半长为 \( \varepsilon_x = 10^{-\mathrm{Precision}[x]} \)，构成乘积区间，并忽略一阶以上的误差项，得到

\[ \mathrm{Precision}[x \cdot y] = -\log_{10}\left(10^{-\mathrm{Precision}[x]} + 10^{-\mathrm{Precision}[y]}\right). \]

同样的线性化模型可推广到函数：对带误差 Δx 的输入施加二阶连续可微函数 f，输出误差约为 \( f'(x) \cdot \Delta x \)，因此精度的变化等于相对条件数 \( |x f'(x) / f(x)| \) 的对数<sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup>。因此，一个良态步骤可以*获得*精度：施加平方根会使精度提高 \( \log_{10} 2 \approx 0.301 \) 个十进制位，因为 \( \sqrt{x} \) 的相对条件数为 1/2<sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup>。

由于位数是被追踪而非固定的，这种算术还可以在函数的条件性要求时*提高*工作精度。对精度为 16 的小数值 x 计算 \( e^x \)，会得到精度为 26 的结果，因为指数函数在零点附近极为不敏感；再减去精确的 1，所得值仍携带精度 16，因此 \( (e^x - 1)/x \) 无需任何代数变形即可准确求值<sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup>。在固定精度的 IEEE 算术中，同一表达式会遭受灾难性抵消，对小 x 返回诸如 0.9992 甚至 0 的值<sup>[6](https://forums.wolfram.com/mathgroup/archive/2000/Jun/msg00316.html)</sup>。

## 历史

以计算机发展的历史衡量，这一思想相当古老。20 世纪 60 年代，罗伯特·阿舍赫斯特（Robert Ashenhurst）、尼古拉斯·梅特罗波利斯（Nicholas Metropolis）等人研究了一种称为有效数字算术的技术：对非规格化数进行算术运算，使答案中剩余有效数字的计数提供其准确度的估计，从而使该方法成为一种自动误差分析<sup>[3](https://pages.stat.wisc.edu/~bwu62/771/hingham2002.pdf)</sup>。梅特罗波利斯的版本基于和与积的方差的近似公式，适用于操作数的变异系数较小时，并使用对数关系来确定结果中的有效数字位数<sup>[7](https://paperzz.com/doc/7156907/probabilistic-arithmetic---anu-college-of-engineering-and)</sup>。

尽管早期热情高涨，该模型因两个原因而失宠：与演变为 IEEE 754 标准的硬件固定精度实现相比效率低下；其误差估计采用整数误差度量计算，往往过于悲观而缺乏实用价值<sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup>。

## 在 Mathematica 中的实现

Mathematica 在软件中复兴了这一思想。据康拉德·沃尔夫勒姆（Conrad Wolfram）——数学家、Wolfram Research 联合创始人、computerbasedmath.org 教育项目负责人——介绍，该语言从一开始就具备有效数字和大数算术，并有用于指定输入精度的反引号记法，以及计算有效数字并只输出有依据数字的函数<sup>[5](https://www.conradwolfram.com/writings/2016/7/8/how-significant-is-significance)</sup>。高精度算术的精度追踪机制最初由杰里·凯珀（Jerry Keiper，1953–1995）在 Wolfram Research 开发，他是 Mathematica 大部分数值函数求值背后的数值架构师<sup>[8](https://library.wolfram.com/infocenter/Conferences/7520/IWU_Talk.pdf)</sup><sup> • </sup><sup>[9](https://www.stephenwolfram.com/publications/jerry-keiper/)</sup>。

该实现随版本演进而发展。Mathematica 的第一个版本使用所谓的非规格化方法，本质上计算前导零之后剩余的有效数字；在 2.0 版之前，Accuracy 和 Precision 的值是反映有效数字索引的整数，而从后续版本开始，它们遵循上述连续误差模型，返回未取整的值<sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup>。一个设计前提是，底层运算中位数的动态控制应基于操作数的精度，而非固定的存储格式限制，这适合尾数长度可以在很大范围内变化的软件实现<sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup>。

机器精度数不在这一机制之内：当计算涉及机器数时，舍入误差不被追踪；将机器精度输入与任意精度输入混合，会产生无误差监控的机器精度结果<sup>[10](https://support.wolfram.com/42750?src=tips-tricks)</sup>。对于表达式，Precision 返回各组成子表达式中的最小精度<sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup>。

## 与区间算术的关系

区间算术中每个量都是一个保证包含真值的闭区间，可视为有效数字算术的严格版本<sup>[11](https://mathworld.wolfram.com/IntervalArithmetic.html)</sup>。两者做出不同的主张。区间算术产生有保证的包络，代价是速度慢，且对现实计算往往给出过于悲观的结果<sup>[11](https://mathworld.wolfram.com/IntervalArithmetic.html)</sup>；有效数字算术产生近似的误差界，成本低到足以嵌入日常算术，并且适用于更广泛的问题<sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup>。

两种方法都面临同样的结构性问题——依赖性问题：当同一变量在表达式中多次出现时，区间运算将每次出现视为独立，所得边界远远宽于真实范围<sup>[12](https://octave.sourceforge.io/interval/package_doc/Introduction-to-Interval-Arithmetic.html)</sup>。有效数字算术面临镜像的假设：其误差模型将操作数的误差视为独立，可以构造出相关误差违反这一假设的例子<sup>[6](https://forums.wolfram.com/mathgroup/archive/2000/Jun/msg00316.html)</sup>。独立性假设在多大范围内普遍有用，以及纠正步骤能否更好地反映误差相关性，被该方法的实现者描述为未决问题；对于线性代数和微分方程求解等大规模数值程序，Mathematica 实际上改用具有经过充分研究的误差界的固定精度算术<sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup>。

## 批评与局限

威廉·卡汉（William Kahan），加州大学伯克利分校计算机科学荣休教授、IEEE 754 浮点算术的主要架构师之一，一直是持续的批评者。他将有效数字算术描述为一种尝试：对每个中间和最终结果，只保留那些被认为未被先前舍入或其他误差污染的数字<sup>[13](https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf)</sup>。在一项误差诊断方案的综述中，他将有效数字算术（Mathematica 等使用）与区间算术、仿射算术以及随机舍入重复运行归为一类，并判断迄今所有这些方案至少缺乏四项要求中的两项：在计算过于不精确时几乎必然发出警告；误报足够少而可容忍；运行速度最多比原程序慢数倍；无需所有模块的源代码即可使用<sup>[14](https://people.eecs.berkeley.edu/~wkahan/Hdlbrg2.pdf)</sup>。

Rump 多项式说明了该方法所针对的危险及其诊断价值。在 S/370 上以单精度、双精度和扩展精度在 x = 77617、y = 33096 处求值，该多项式给出的结果前导数字一致，但全部错误，甚至符号也错<sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup>。有效数字算术报告精度损失约 38 位，与计算出的相对条件数 \( 3.82748 \times 10^{37} \) 相符，其以 10 为底的对数为 37.5829<sup>[2](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)</sup>。追踪的精度损失与解析计算的条件数之间的一致性，正是该方法作为自动误差分析发挥作用的体现<sup>[3](https://pages.stat.wisc.edu/~bwu62/771/hingham2002.pdf)</sup>。

## References

1. [Weisstein, Eric W. "Significance Arithmetic." MathWorld--A Wolfram Resource.](https://mathworld.wolfram.com/SignificanceArithmetic.html)
2. [Mark Sofroniou and Giulia Spaletta (2005). "Precise Numerical Computation." Journal of Logic and Algebraic Programming 64: 113–134.](https://citeseerx.ist.psu.edu/document?doi=943796a8e1764940ef621113f703bae4634025c1&repid=rep1&type=pdf)
3. ["Automatic Error Analysis" (encyclopedia entry describing Ashenhurst, Metropolis, and significance arithmetic).](https://pages.stat.wisc.edu/~bwu62/771/hingham2002.pdf)
4. ["Precision" — Wolfram Language Documentation, Wolfram Research.](https://reference.wolfram.com/language/ref/Precision.html.en?source=footer)
5. [Conrad Wolfram (8 July 2016). "How Significant is Significance Arithmetic?" computerbasedmath.org.](https://www.conradwolfram.com/writings/2016/7/8/how-significant-is-significance)
6. [Mark Sofroniou (21 June 2000). "Re: RE: Working Precision." MathGroup Archive, Wolfram Research.](https://forums.wolfram.com/mathgroup/archive/2000/Jun/msg00316.html)
7. ["Probabilistic Arithmetic" (discussion of Metropolis's significance arithmetic).](https://paperzz.com/doc/7156907/probabilistic-arithmetic---anu-college-of-engineering-and)
8. ["An Overview of Computation at the Symbolic–Numeric Interface," Wolfram conference talk.](https://library.wolfram.com/infocenter/Conferences/7520/IWU_Talk.pdf)
9. [Stephen Wolfram. "Jerry Keiper (1953–1995)."](https://www.stephenwolfram.com/publications/jerry-keiper/)
10. ["What types of computer arithmetic does the Wolfram Language support?" Wolfram Support Quick Answers.](https://support.wolfram.com/42750?src=tips-tricks)
11. [Weisstein, Eric W. "Interval Arithmetic." MathWorld--A Wolfram Resource.](https://mathworld.wolfram.com/IntervalArithmetic.html)
12. ["Introduction to Interval Arithmetic," GNU Octave Interval Package Manual.](https://octave.sourceforge.io/interval/package_doc/Introduction-to-Interval-Arithmetic.html)
13. [W. Kahan. "Mindless Assessments of Roundoff in Floating-Point Computation." UC Berkeley.](https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf)
14. [W. Kahan (2014). "Desperately Needed Remedies for the Undebuggability of Large-Scale Floating-Point Computations." UC Berkeley.](https://people.eecs.berkeley.edu/~wkahan/Hdlbrg2.pdf)

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

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Arithmetic and number systems › Computational arithmetic › Affine and significance arithmetic

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/significance-arithmetic

English original: https://www.edgepedia.org/significance-arithmetic
