Advertisement
cwchen

[Rust] Compare the error in floating-point numbers

Aug 22nd, 2017
506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.08 KB | None | 0 0
  1. use std::f64;
  2.  
  3. fn main() {
  4.     assert!(f64::abs((0.3 - 0.2) - 0.1) < 1e-10);
  5. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement