Update rust_decimal.

This commit is contained in:
Stephen Chung 2021-04-18 21:35:55 +08:00
parent bd145bd080
commit 1145c5a4c0
2 changed files with 5 additions and 5 deletions

View File

@ -88,7 +88,7 @@ default_features = false
optional = true optional = true
[dependencies.rust_decimal] [dependencies.rust_decimal]
version = "1.10" version = "1.11"
default_features = false default_features = false
optional = true optional = true

View File

@ -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)] #[rhai_fn(return_raw)]
pub fn round_down(x: Decimal, dp: INT) -> Result<Decimal, Box<EvalAltResult>> { pub fn round_down(x: Decimal, dp: INT) -> Result<Decimal, Box<EvalAltResult>> {
@ -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)] #[rhai_fn(return_raw)]
pub fn round_half_up(x: Decimal, dp: INT) -> Result<Decimal, Box<EvalAltResult>> { pub fn round_half_up(x: Decimal, dp: INT) -> Result<Decimal, Box<EvalAltResult>> {
@ -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)] #[rhai_fn(return_raw)]
pub fn round_half_down(x: Decimal, dp: INT) -> Result<Decimal, Box<EvalAltResult>> { pub fn round_half_down(x: Decimal, dp: INT) -> Result<Decimal, Box<EvalAltResult>> {
@ -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")] #[rhai_fn(name = "int", get = "int")]
pub fn int(x: Decimal) -> Decimal { pub fn int(x: Decimal) -> Decimal {