Skip to main content

quadratic_roots

Function quadratic_roots 

Source
pub fn quadratic_roots(a: f64, b: f64, c: f64) -> Vec<f64>
Expand description

Real roots of a x^2 + b x + c.

Uses the citardauq form for whichever root would otherwise be computed as a difference of nearly equal numbers. The schoolbook formula loses most of its precision for the smaller root when b^2 >> 4ac, which is the common case for a ray grazing a sphere.