pub fn relative_error(numerical: f64, reference: f64) -> f64Expand description
Normalized relative error between a numerical value and a reference.
Returns |numerical - reference| / max(|reference|, floor). With the
default floor this equals the signed relative error whenever the reference
is not degenerate, and collapses to an absolute error when the reference is
near zero.
ยงExamples
use solver::validation::relative_error;
assert!((relative_error(1.01, 1.0) - 0.01).abs() < 1e-15);
assert!((relative_error(0.0, 0.0)).abs() < 1e-15);