round2rs

Crates.ioround2rs
lib.rsround2rs
version0.1.3
sourcesrc
created_at2024-03-15 07:28:56.334002
updated_at2024-03-15 07:42:21.510451
descriptionBased on round-to NPM Crate
homepagehttps://github.com/yexiuph/round2rs
repositoryhttps://github.com/yexiuph/round2rs
max_upload_size
id1174482
size4,166
Christian Louis Abrigo (yexiuph)

documentation

https://github.com/yexiuph/round2rs

README

round2rs

Round a number to a specific number of decimal places: 1.2341.2 supports negative numbers as well

Install

cargo add round-to

Usage

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

API

number

Type: number

The number to adjust.

precision

Type: number (Integer or infinity)

The number of decimal places.

Commit count: 0

cargo fmt