pub fn linear_weight(x1: f64, x2: f64, x: f64) -> f64Expand description
Calculates the interpolation weight between x1 and x2 for a value x.
The returned weight w satisfies y = (1 - w) * y1 + w * y2 when
interpolating ordinates that correspond to abscissas x1 and x2.
ยงPanics
- If any input is NaN or infinite.
- If
x1andx2are too close (within machine epsilon), which would cause division by zero or numerical instability.