approx_eq

Build Status Crates.io Documentation

This crate provides a macro to check whether two numbers are approximately equal. It does so by checking that the relative difference between the two numbers is less than some upper limit.

To use this in your Rust program, add the following to your Cargo.toml file:

rust // Cargo.toml [dependencies] approx_eq = "0.1"

Using this macro is easy!

```rust // main.rs use approxeq::assertapprox_eq;

fn main() { assertapproxeq!(1., 0.99999999999); // should pass assertapproxeq!(1., 0.99999999999, 1e-5); // should pass assertapproxeq!(1., 0.99999999999, 1e-20); // should fail assertapproxeq!(1., 2.) // should fail } ```