Skip to content

正确性审计台账

这份台账把当前 0.2.0 实现与显式语义契约逐项对齐。

状态标签:

  • Verified
  • Verified with approximation boundary
  • Known limitation

@def

API契约实现锚点校验证据状态
Sign / FpClass / RoundingMode在各数值包中一致承担共享语义枚举角色。src/def/types.mbtdef predicates classify finite nan and enclosing zero consistently;包级代码审阅。Verified
Floating共享能力面只覆盖分类、符号、精度、重调精度与规范化。src/def/types.mbt跨包编译使用与 helper predicate 测试。Verified
is_finite / is_nan / is_infinite / is_zero基于 class/sign 判断;is_zero 拒绝 NaN,并接受跨零包络。src/def/types.mbtdef predicates classify finite nan and enclosing zero consistently;既有 NaN 回归测试。Verified

@internal

API契约实现锚点校验证据状态
bigint_zero / bigint_one / abs_bigint / sign_of_bigint规范的整数辅助函数。src/internal/core.mbt被全部数值包传递使用;符号行为由 predicate 与规范化测试间接覆盖。Verified
pow2 / pow5 / pow10 / digits10精确幂函数与十进制位数计算。src/internal/core.mbtbin_float / decimal 构造与转换测试;解析与规范化测试。Verified
remove_factor2 / remove_factor10剥离可移除的基数因子且保持表示值不变。src/internal/core.mbtbin_float normalizes powers of twodecimal make and display normalize trailing zerosVerified
round_positive_div / round_shift / compare_abs对非负量级执行定向与 tie-aware 舍入;compare_abs 只比较绝对值。src/internal/core.mbtinternal rounding helpers honor tie and directed modesVerified
split_decimal_string接受普通/科学计数十进制字符串并拒绝坏格式。src/internal/core.mbtinternal decimal parser accepts scientific notation and rejects malformed stringsdecimal parses and normalizesVerified

@bin_float

API契约实现锚点校验证据状态
make / zero / one / from_int / from_bigint有限值构造会规范化到标准二进制形式。src/bin_float/bin_float.mbtbin_float normalizes powers of twobin_float arithmetic stays exact on small dyadicsVerified
inf / nan / classify / sign / precision特殊值保持分类与存储精度语义。src/bin_float/bin_float.mbtpredicate 测试、compare 测试、特殊值算术代码审阅。Verified
significand / exponent2 / normalized / is_zero暴露规范化有限表示与零判定。src/bin_float/bin_float.mbt规范化测试、predicate 测试、代码审计。Verified
with_precision / ulp精度重调遵守请求的舍入模式;ulp 返回表示局部的间距值。src/bin_float/bin_float.mbtbin_float with_precision rounds and ulp tracks spacingVerified
add / sub / mul / div在可表示的小 dyadic 上保持精确;特殊值按当前实现传播。src/bin_float/bin_float.mbtbin_float arithmetic stays exact on small dyadics;既有转换与特殊值测试。Verified with approximation boundary
compare仅对有序值提供全序;遇到 NaN 拒绝。src/bin_float/bin_float.mbtbin_float compare orders finite and infinities;NaN 分支代码审阅。Verified

@decimal

API契约实现锚点校验证据状态
make / zero / one / from_int / from_bigint / from_string十进制构造会去除尾随零,并接受当前支持的文本格式。src/decimal/decimal.mbtdecimal parses and normalizesdecimal make and display normalize trailing zeros;parser 测试。Verified
inf / nan / classify / sign / precision特殊值与符号语义符合包契约。src/decimal/decimal.mbtpredicate 测试与特殊值算术代码审阅。Verified
coefficient / exponent10 / is_zero / normalized / with_precision暴露标准十进制表示与重调精度后的有限值。src/decimal/decimal.mbt规范化/显示测试与代码审计。Verified
neg / abs / add / sub / mul / div可表示时保持十进制精确;否则按包规则舍入。src/decimal/decimal.mbtdecimal arithmetic and display;转换驱动回归检查。Verified with approximation boundary
to_bin_float / from_bin_float二进制转换在 dyadic 兼容方向上精确,在非 dyadic 的十进制转二进制方向上近似。src/decimal/decimal.mbtdecimal binary conversion preserves dyadics exactlydecimal to bin conversion handles non-dyadic valuesbin to decimal conversion is exact for finite valuesVerified with approximation boundary

@ball_float

API契约实现锚点校验证据状态
new在中心量化后仍保持原始包络被包含。src/ball_float/ball_float.mbtball_float new preserves an input endpoint after center roundingVerified
exact把有限 BinFloat 嵌入成球;即使降精度也仍包含源值。src/ball_float/ball_float.mbtball_float exact widens when lowering precisionVerified
from_decimal基于有限十进制源值构造二进制包络。src/ball_float/ball_float.mbt既有 ball_float from_decimal keeps low precision enclosureVerified with approximation boundary
center / radius / precision / classify / sign / normalized / with_precision暴露存储包络、有限分类、按包络定义的符号,以及保持包含关系的规范化/重调精度。src/ball_float/ball_float.mbtdef predicates classify finite nan and enclosing zero consistentlyball_float sign and overlap relations remain enclosure based;exact-widen 回归。Verified
contains / overlaps / separated_from / definitely_lt / definitely_gt / maybe_overlap关系 API 基于区间语义,而不是标量全序。src/ball_float/ball_float.mbtball_float overlap detects separated ballsball_float sign and overlap relations remain enclosure based;exact containment 测试。Verified
add / sub / mul / div算术返回的球会包住真实结果,并把输出舍入位移也并入半径;除法拒绝分母球包含零。src/ball_float/ball_float.mbtball_float multiplication keeps exact scalar result inside zero-radius inputsball_float division keeps exact scalar result inside zero-radius inputs;零分母分支代码审阅。Verified with approximation boundary