diff options
Diffstat (limited to 'src/libcore/cmp.rs')
| -rw-r--r-- | src/libcore/cmp.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index b933b60a39f..80f1f05961a 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -66,6 +66,13 @@ totaleq_impl!(uint) totaleq_impl!(char) +/// Trait for testing approximate equality +pub trait ApproxEq<Eps> { + fn approx_epsilon() -> Eps; + fn approx_eq(&self, other: &Self) -> bool; + fn approx_eq_eps(&self, other: &Self, approx_epsilon: &Eps) -> bool; +} + #[deriving(Clone, Eq)] pub enum Ordering { Less = -1, Equal = 0, Greater = 1 } |
