pub const ERR_COEFF_2: f64 = _; // 6.6613381477509471E-16f64Expand description
Absolute error coefficient for Matrix::<2>::det_direct.
For any 2×2 matrix A = [[a, b], [c, d]] with finite f64 entries,
|A.det_direct() - det_exact(A)| ≤ ERR_COEFF_2 · (|a·d| + |b·c|)det_direct evaluates a·d - b·c as one multiply followed by one FMA
(2 rounding events); the linear 3·EPS term bounds those roundings
and the quadratic 16·EPS² term is a conservative cushion for their
interaction. Derivation follows Shewchuk’s framework; see
REFERENCES.md [8].
Prefer Matrix::det_errbound unless
you already have the absolute-Leibniz sum available; see
Matrix::det_sign_exact (under the
exact feature) for the reference adaptive-precision filter.
§Example
use la_stack::prelude::*;
let m = Matrix::<2>::from_rows([[1.0, 2.0], [3.0, 4.0]]);
let det = m.det_direct().unwrap();
// Compute the bound from the raw constant for illustration; most
// callers would just use `m.det_errbound().unwrap()` instead.
let p = (1.0_f64 * 4.0).abs() + (2.0_f64 * 3.0).abs();
let bound = ERR_COEFF_2 * p;
if det.abs() > bound {
// The f64 sign is provably correct without exact arithmetic.
}