1 unstable release
Uses new Rust 2024
0.1.2 | Mar 29, 2025 |
---|---|
0.1.1 |
|
0.1.0 |
|
#61 in #place
347 downloads per month
4KB
Decimals
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!
Examples
use decimals::Decimals;
assert_eq!(1.23456789.round_to(2), 1.23);
assert_eq!(1.23456789.round_to(3), 1.235);