fix: update rounding strategy

This commit is contained in:
Stefan
2025-06-03 09:47:38 +02:00
parent e739523864
commit 5cd06117f0
2 changed files with 9 additions and 2 deletions
+5 -2
View File
@@ -313,7 +313,7 @@ pub(crate) mod imp {
#[cfg(feature = "regex-lite")]
use regex_lite::Regex;
use rust_decimal::prelude::{FromPrimitive, ToPrimitive};
use rust_decimal::Decimal;
use rust_decimal::{Decimal, RoundingStrategy};
use rust_decimal_macros::dec;
use std::collections::BTreeMap;
use std::rc::Rc;
@@ -473,7 +473,10 @@ pub(crate) mod imp {
.transpose()?
.unwrap_or(0);
Ok(V::Number(a.round_dp(dp)))
Ok(V::Number(a.round_dp_with_strategy(
dp,
RoundingStrategy::MidpointAwayFromZero,
)))
}
pub fn trunc(args: Arguments) -> anyhow::Result<V> {
+4
View File
@@ -441,6 +441,10 @@ round(7.6);; 8
round(-7.4);; -7
round(-7.5);; -8
round(-7.6);; -8
round(0.5);;1
round(-0.5);;-1
round(1.5);;2
round(-1.5);;-2
round(7.444, 0);; 7
round(7.444, 1);; 7.4
Can't render this file because it contains an unexpected character in line 14 and column 13.