Skip to content

Commit

Permalink
Merge pull request #66 from Uriopass/patch-1
Browse files Browse the repository at this point in the history
Add Zero impl for OrderedFloat
  • Loading branch information
mbrubeck committed Jun 29, 2020
2 parents 90f4ca8 + 9a241dc commit 57e16fd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib.rs
Expand Up @@ -195,6 +195,12 @@ impl<T: Float> Neg for OrderedFloat<T> {
}
}

impl<T: Float> Zero for OrderedFloat<T> {
fn zero() -> Self { OrderedFloat(T::zero()) }

fn is_zero(&self) -> bool { self.0.is_zero() }
}

/// A wrapper around Floats providing an implementation of Ord and Hash.
///
/// A NaN value cannot be stored in this type.
Expand Down

0 comments on commit 57e16fd

Please sign in to comment.