12个版本 (2个稳定版)
| 1.0.1 | 2024年4月22日 |
|---|---|
| 0.0.12 | 2024年4月12日 |
817 在 算法 中
每月30次下载
7KB
此crate扩展了浮点数(f64和f32)的特质方法round_to_fraction(),允许您将浮点数四舍五入到指定的分数位数。
示例
use round_float::RoundToFraction;
let full_float = 12.34567;
let rounded_float = full_float.round_to_fraction(2);
assert_eq!(rounded_float, 12.35);
依赖项
~195–280KB