pub trait F64Ext {
    // Required method
    fn round_decimal_places(self, _: u32) -> f64;
}

Required Methods§

source

fn round_decimal_places(self, _: u32) -> f64

Round a number to a certain amount of decimal places.

Arguments
  • self - The value to round.
  • decimal_places - The amount of decimal places to round this to.
Returns

The rounded value.

Examples
use libhealth::utils::prelude::*;

let val: f64 = 13.54231;
assert_eq!(val.round_decimal_places(1), 13.5);
assert_eq!(val.round_decimal_places(2), 13.54);

Implementations on Foreign Types§

source§

impl F64Ext for f64

source§

fn round_decimal_places(self, decimal_places: u32) -> f64

Implementors§