Skip to content

Commit

Permalink
Add scientific notation Display impls (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
SV-97 authored Oct 1, 2022
1 parent 722b2a9 commit f2900d6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,20 @@ impl<T: Float + fmt::Display> fmt::Display for OrderedFloat<T> {
}
}

impl<T: Float + fmt::LowerExp> fmt::LowerExp for OrderedFloat<T> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}

impl<T: Float + fmt::UpperExp> fmt::UpperExp for OrderedFloat<T> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}

impl From<OrderedFloat<f32>> for f32 {
#[inline]
fn from(f: OrderedFloat<f32>) -> f32 {
Expand Down

0 comments on commit f2900d6

Please sign in to comment.