Function math::round::half_away_from_zero [] [src]

pub fn half_away_from_zero(value: f64, scale: u8) -> f64

Round half away from zero.

Round value to scale number of decimal digits rounding half away from zero.

Arguments

  • value - value to round
  • scale - number of decimal digits

Example

use math::round;

let rounded = round::half_away_from_zero(3.14159, 3);
assert_eq!(rounded, 3.142);