#notation #engineering #f64 #traits #string #containing

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

#317 in Value formatting

Download history 73/week @ 2024-11-29 93/week @ 2024-12-06 47/week @ 2024-12-13 84/week @ 2024-12-20 29/week @ 2024-12-27 244/week @ 2025-01-03 281/week @ 2025-01-10 223/week @ 2025-01-17 392/week @ 2025-01-24 399/week @ 2025-01-31 176/week @ 2025-02-07 73/week @ 2025-02-14 56/week @ 2025-02-21 46/week @ 2025-02-28 22/week @ 2025-03-07 42/week @ 2025-03-14

170 downloads per month
Used in 2 crates

BSD-3-Clause

10KB
242 lines

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.

lib.rs:

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);

No runtime deps