Crates.io | round_float |
lib.rs | round_float |
version | 1.2.2 |
source | src |
created_at | 2024-04-11 06:38:06.020217 |
updated_at | 2024-08-26 07:35:24.913478 |
description | Round `f64` and `f32` to specified number of decimals. |
homepage | |
repository | https://github.com/amab8901/round_float |
max_upload_size | |
id | 1204454 |
size | 15,553 |
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.
use round_float::RoundToFraction;
let full_float = 12.34567;
let rounded_float = full_float.round_to_fraction(2);
assert_eq!(rounded_float, 12.35);