Struct approx::Relative [] [src]

pub struct Relative<'a, T: 'a + ApproxEq> {
    pub lhs: &'a T,
    pub rhs: &'a T,
    pub epsilon: T::Epsilon,
    pub max_relative: T::Epsilon,
}

The requisite parameters for testing for approximate equality.

Fields

The left-hand side of the approximate equality comparison.

The right-hand side of the approximate equality comparison.

The tolerance to use when testing values that are close together.

The relative tolerance for testing values that are far-apart.

Methods

impl<'a, T> Relative<'a, T> where
    T: ApproxEq
[src]

The beginning of a chained equality expression, using a relative based comparison.

use std::f64;
use approx::Relative;

Relative::new(&1.0, &1.0).eq();
Relative::new(&1.0, &1.0).epsilon(f64::EPSILON).eq();
Relative::new(&1.0, &1.0).max_relative(1.0).eq();
Relative::new(&1.0, &1.0).epsilon(f64::EPSILON).max_relative(1.0).eq();
Relative::new(&1.0, &1.0).max_relative(1.0).epsilon(f64::EPSILON).eq();

Replace the epsilon value with the one specified.

Replace the maximum relative value with the one specified.

Peform the equality comparison

Peform the inequality comparison