#formatting #notation #engineering #f64 #containing #traits #rate #string

eng_fmt

Zero-depedency rate containing trait providing engineering notation formatting for f64

3 releases

0.1.2 Sep 18, 2023
0.1.1 Sep 18, 2023
0.1.0 Sep 15, 2023

#23 in #engineering

Download history 24/week @ 2025-03-10 60/week @ 2025-03-17 108/week @ 2025-03-24 184/week @ 2025-03-31 266/week @ 2025-04-07 177/week @ 2025-04-14 288/week @ 2025-04-21 351/week @ 2025-04-28 170/week @ 2025-05-05 288/week @ 2025-05-12 315/week @ 2025-05-19 247/week @ 2025-05-26 59/week @ 2025-06-02 93/week @ 2025-06-09 53/week @ 2025-06-16 80/week @ 2025-06-23

285 downloads per month
Used in 3 crates

BSD-3-Clause

10KB
242 lines

Module containing trait to format f64 in engineering notation.

Examples

use eng_fmt::FormatEng;
let x: f64 = 0.010;
let expected = "10.0e-3".to_string();
assert_eq!(x.format_eng(None), expected);
use eng_fmt::FormatEng;
let x = std::f64::consts::PI;
let expected = "3.142".to_string();
assert_eq!(x.format_eng(Some(4)), expected);
use eng_fmt::FormatEng;
let x = 6.022e-23;
let expected = "60.2e-24".to_string();
assert_eq!(x.format_eng(None), expected);

eng_fmt

This is a Rust crate that formats f64 as a String in engineering notation.

Change Log

  • 0.1.2: Tweaked this readme and fixed a bad link.
  • 0.1.1: Provided much better examples in documentation.

No runtime deps