| Crates.io | decimals |
| lib.rs | decimals |
| version | 0.1.2 |
| created_at | 2025-03-29 14:50:46.89959+00 |
| updated_at | 2025-03-29 15:41:41.63985+00 |
| description | A Rust library for rounding to a number of decimal places |
| homepage | |
| repository | https://github.com/dskyberg/decimals |
| max_upload_size | |
| id | 1611369 |
| size | 3,279 |
This module provides a single trait for rounding floating-point numbers to a specified number of decimal places. That's all!
This should really be part of the standard library, or at least in the num crate. But it's not!
use decimals::Decimals;
assert_eq!(1.23456789.round_to(2), 1.23);
assert_eq!(1.23456789.round_to(3), 1.235);