Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scientific notation Display impls #112

Merged
merged 1 commit into from Oct 1, 2022
Merged

Conversation

SV-97
Copy link
Contributor

@SV-97 SV-97 commented Sep 30, 2022

Description

I just ran into a case where I wanted to format OrderedFloats in scientific notation using std::fmt::LowerExp and std::fmt::UpperExp. This adds delegate implementations for both of those traits.

Example:

use ordered_float::OrderedFloat;

fn main() {
    let n = OrderedFloat(10.2);
    println!("{:+.2e}", n); // prints "+1.02e1"
}

@mbrubeck mbrubeck merged commit f2900d6 into reem:master Oct 1, 2022
@mbrubeck
Copy link
Collaborator

mbrubeck commented Oct 1, 2022

Thanks! Published as version 3.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants