https://github.com/liamgallagher737/ufloat
A no_std compatible library for formatting floating point numbers with ufmt
https://github.com/liamgallagher737/ufloat
no-std rust ufmt
Last synced: 5 months ago
JSON representation
A no_std compatible library for formatting floating point numbers with ufmt
- Host: GitHub
- URL: https://github.com/liamgallagher737/ufloat
- Owner: LiamGallagher737
- License: apache-2.0
- Created: 2024-11-23T03:49:24.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-11-25T05:43:29.000Z (7 months ago)
- Last Synced: 2024-12-23T06:12:09.786Z (6 months ago)
- Topics: no-std, rust, ufmt
- Language: Rust
- Homepage: https://crates.io/crates/ufloat
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# ufloat
A `no_std` compatible library for formatting floating point numbers with [`ufmt`](https://crates.io/crates/ufmt)
[](https://crates.io/crates/ufloat)
[](https://docs.rs/ufloat/latest/ufloat)Formatting a float is now as easy as wrapping it in either the [`Uf32`](https://docs.rs/ufloat/latest/ufloat/struct.Uf32.html) or [`Uf64`](https://docs.rs/ufloat/latest/ufloat/struct.Uf64.html) struct with the number of decimal places to format to.
```rust
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`](https://crates.io/crates/libm) crate is used for math operations.