Module arithmetic

Source
Expand description

Arbitrary-length expansion arithmetic.

An expansion is a list of non-overlapping f64 components whose exact sum is the value it represents. Two f64s can hold a product exactly; a list can hold an arbitrary determinant exactly. This is what lets orient3d, incircle, and insphere certify a sign rather than guess one.

Components are ordered smallest to largest, so the sign of a non-zero expansion is the sign of its last component.

§Cost and where it is paid

These operations allocate. That is deliberate and confined to the exact path, which a filtered predicate reaches only when the floating-point determinant is too close to zero to trust. The benchmark harness measures the escalation rate precisely so this cost is a number, not a hope.

Functions§

expansion_product
Multiply two expansions exactly.
expansion_sign
Sign of an expansion.
expansion_sum
Sum of two expansions, exactly.
grow_expansion
Grow an expansion by one scalar: e + b, exactly.
negate_expansion
Negate every component. Exact: negation is always representable.
scale_expansion
Scale an expansion by a scalar, exactly.