round_float

Crates.ioround_float
lib.rsround_float
version1.0.1
sourcesrc
created_at2024-04-11 06:38:06.020217
updated_at2024-04-22 13:48:59.101725
descriptionRound `f64` and `f32` to specified number of decimals.
homepage
repositoryhttps://github.com/amab8901/round_float
max_upload_size
id1204454
size15,060
Iron(III) Oxide (amab8901)

documentation

https://docs.rs/round_float

README

This crate extends your float numbers (f64 and f32) with the trait method round_to_fraction(), which lets you round the float number to a specified number of fraction digits.

Example

use round_float::RoundToFraction;

let full_float = 12.34567;
let rounded_float = full_float.round_to_fraction(2);

assert_eq!(rounded_float, 12.35);
Commit count: 24

cargo fmt