f64-fixed

Crates.iof64-fixed
lib.rsf64-fixed
version0.2.1
created_at2025-11-11 15:11:16.532826+00
updated_at2025-11-14 13:04:27.336193+00
descriptionConvert f64 to fixed-length string
homepage
repositoryhttps://github.com/nanvel/f64-fixed
max_upload_size
id1927443
size7,096
Oleksandr (nanvel)

documentation

README

f64-fixed converts f64 to a fixed size String

Use cases:

  • Display arbitrary numbers on a device with limited number of indicators
  • Display a number in a fixed-font where alignment matters or space is limited

Usage

use f64_fixed::{to_fixed_string, ToFixedString};

assert_eq!(12345.0_f64.to_fixed_string(6), "12345 ");

assert_eq!(to_fixed_string(1., 6), "1     ");
assert_eq!(to_fixed_string(1., -6), "     1");

assert_eq!(to_fixed_string(12345., 6), "12345 ");
assert_eq!(to_fixed_string(123456., 6), "123456");
assert_eq!(to_fixed_string(1234567., 6), "1.23+6");
Commit count: 0

cargo fmt