From 1145c5a4c09038545a30308194dcd06e903ff693 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sun, 18 Apr 2021 21:35:55 +0800 Subject: [PATCH] Update rust_decimal. --- Cargo.toml | 2 +- src/packages/math_basic.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d6e30562..e97fc7f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -88,7 +88,7 @@ default_features = false optional = true [dependencies.rust_decimal] -version = "1.10" +version = "1.11" default_features = false optional = true diff --git a/src/packages/math_basic.rs b/src/packages/math_basic.rs index 1012b6d2..c3e992e0 100644 --- a/src/packages/math_basic.rs +++ b/src/packages/math_basic.rs @@ -351,7 +351,7 @@ mod decimal_functions { } } - Ok(x.round_dp_with_strategy(dp as u32, RoundingStrategy::RoundUp)) + Ok(x.round_dp_with_strategy(dp as u32, RoundingStrategy::AwayFromZero)) } #[rhai_fn(return_raw)] pub fn round_down(x: Decimal, dp: INT) -> Result> { @@ -367,7 +367,7 @@ mod decimal_functions { } } - Ok(x.round_dp_with_strategy(dp as u32, RoundingStrategy::RoundDown)) + Ok(x.round_dp_with_strategy(dp as u32, RoundingStrategy::ToZero)) } #[rhai_fn(return_raw)] pub fn round_half_up(x: Decimal, dp: INT) -> Result> { @@ -383,7 +383,7 @@ mod decimal_functions { } } - Ok(x.round_dp_with_strategy(dp as u32, RoundingStrategy::RoundHalfUp)) + Ok(x.round_dp_with_strategy(dp as u32, RoundingStrategy::MidpointAwayFromZero)) } #[rhai_fn(return_raw)] pub fn round_half_down(x: Decimal, dp: INT) -> Result> { @@ -399,7 +399,7 @@ mod decimal_functions { } } - Ok(x.round_dp_with_strategy(dp as u32, RoundingStrategy::RoundHalfDown)) + Ok(x.round_dp_with_strategy(dp as u32, RoundingStrategy::MidpointTowardZero)) } #[rhai_fn(name = "int", get = "int")] pub fn int(x: Decimal) -> Decimal {