#float #no-std #floating-point #no-alloc #ufmt

no-std ufloat

Wrappers around floating point numbers with ufmt trait implementations

1 unstable release

0.1.0 Nov 23, 2024

#702 in Embedded development

Download history 143/week @ 2024-11-18 25/week @ 2024-11-25 19/week @ 2024-12-02 8/week @ 2024-12-09

195 downloads per month
Used in radian

MIT/Apache

10KB
172 lines

ufloat

A no_std compatible library for formatting floating point numbers with ufmt

crates.io docs.rs

Formatting a float is now as easy as wrapping it in either the Uf32 or Uf64 struct with the number of decimal places to format to.

use ufloat::{Uf32, Uf64};

// Format to 3 decimal places.
let a = Uf32(123.456, 3);
// Format to 5 decimal places.
let b = Uf64(123.45678, 5);

The libm crate is used for math operations.


lib.rs:

A no_std compatible library for formatting floating point numbers with ufmt.

Formatting a float is now as easy as wrapping it in either the Uf32 or Uf64 struct with the number of decimal places to format to.

use ufloat::{Uf32, Uf64};

// Format to 3 decimal places.
let a = Uf32(123.456, 3);
// Format to 5 decimal places.
let b = Uf64(123.45678, 5);

The libm crate is used for math operations.

Dependencies

~2MB
~46K SLoC