added sanity checks
.NET Test / .NET tests (push) Successful in 3m55s

This commit is contained in:
2026-09-18 14:10:24 +04:00
parent b5a8bd2580
commit 5797bf4884
44 changed files with 419 additions and 146 deletions
+9 -5
View File
@@ -24,11 +24,15 @@ not perform double-double arithmetic or allocate on the heap.
a `double`. Addition retains residuals under cancellation; multiplication uses
fused multiply-add; division uses residual corrections. Mixed `double` operators
use specialized scalar paths rather than promoting the scalar to `DoubleDouble`.
Their finite fast paths normalize once with a final sum transform; scalar
division uses one compensated quotient correction within the error contract below.
Division retains the complete first remainder and applies two quotient corrections,
normalizing before the final correction. Mixed addition and subtraction also retain
intermediate sum residuals through final normalization. Mixed addition, subtraction,
and division produce the same component bits as their `DoubleDouble` operations
with the scalar represented as a zero-low pair.
- Exponent boundaries: bounded `BigInteger` calculations avoid intermediate
overflow and underflow on the exceptional finite path. Ordinary arithmetic uses
floating-point transforms without allocations. The stored value remains two
floating-point transforms without allocations, although sparse division correction
products can also reach a boundary path. The stored value remains two
doubles; this is not an arbitrary-precision API.
- Comparisons use both components. `Equals` treats NaNs as equal and signed zeros
as equal for collections. `CompareTo` orders NaN before other values. Numerical
@@ -107,8 +111,8 @@ The `DDMath` static class provides:
It shares the existing `DoubleDouble.Abs` implementation.
- `Reciprocal(DoubleDouble)`: returns exactly the same high and low component bits
as `1.0 / value`. It specializes scalar/DD division for a numerator of one,
omitting only redundant numerator checks while preserving both divisions,
the FMA sequence, and normalization. Signed zeros map to signed infinities,
omitting redundant numerator checks and sharing the finite scalar-numerator kernel,
including both residual corrections and normalization. Signed zeros map to signed infinities,
signed infinities to signed zeros, and NaN to canonical NaN. The allocating exact boundary
path handles extreme exponents; finite overflow produces signed infinity.
No speedup over scalar/DD division has been measured.