| Crates.io | round2rs |
| lib.rs | round2rs |
| version | 0.1.3 |
| created_at | 2024-03-15 07:28:56.334002+00 |
| updated_at | 2024-03-15 07:42:21.510451+00 |
| description | Based on round-to NPM Crate |
| homepage | https://github.com/yexiuph/round2rs |
| repository | https://github.com/yexiuph/round2rs |
| max_upload_size | |
| id | 1174482 |
| size | 4,166 |
Round a number to a specific number of decimal places:
1.234→1.2supports negative numbers as well
cargo add round-to
use round_to::RoundTo;
RoundTo::round_to(1.234, 2);
//=> 1.23
RoundTo::round_to_ceil(1.234, 2);
//=> 1.24
RoundTo::round_to_floor(1.234, 2);
//=> 1.23
Type: number
The number to adjust.
Type: number (Integer or infinity)
The number of decimal places.