Function roots::find_roots_linear
[−]
[src]
pub fn find_roots_linear<F: FloatType>(a1: F, a0: F) -> Roots<F>
Solves a linear equation a1*x + a0 = 0.
Examples
use roots::Roots; use roots::find_roots_linear; // Returns Roots::No([]) as '0*x + 1 = 0' has no roots; let no_root = find_roots_linear(0f32, 1f32); assert_eq!(no_root, Roots::No([])); // Returns Roots::Two([0f64]) as '1*x + 0 = 0' has the root 0 let root = find_roots_linear(1f64, 0f64); assert_eq!(root, Roots::One([0f64])); // Returns Roots::One([0f32]) as 0 is one of roots of '0*x + 0 = 0' let zero_root = find_roots_linear(0f32, 0f32); assert_eq!(zero_root, Roots::One([0f32]));