Facebook
From Sweet Pelican, 3 Years ago, written in Rust.
Embed
Download Paste or View Raw
Hits: 236
  1. extern crate roots;
  2. use roots::Roots;
  3. use roots::find_roots_quadratic;
  4.  
  5. fn main() {
  6.     match find_roots_quadratic(2.3, 1.1, -1.0) {
  7.         Roots::Two(roots) => println!("Two {} {}", roots[0], roots[1]),
  8.         Roots::One(roots) => println!("One {}", roots[0]),
  9.         _ => println!("None")
  10.     }
  11. }