decimals

Crates.iodecimals
lib.rsdecimals
version0.1.2
created_at2025-03-29 14:50:46.89959+00
updated_at2025-03-29 15:41:41.63985+00
descriptionA Rust library for rounding to a number of decimal places
homepage
repositoryhttps://github.com/dskyberg/decimals
max_upload_size
id1611369
size3,279
David Skyberg (dskyberg)

documentation

README

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);
Commit count: 6

cargo fmt