FIX: Fixes ROUND, ROUNDUP and ROUNDDOWN behaviour

This commit is contained in:
Nicolás Hatcher
2025-08-08 18:34:40 +02:00
committed by Nicolás Hatcher Andrés
parent 71d6a3d66c
commit f2cb05d7bf
3 changed files with 22 additions and 3 deletions

View File

@@ -55,6 +55,7 @@ mod test_arrays;
mod test_escape_quotes;
mod test_extend;
mod test_fn_fv;
mod test_fn_round;
mod test_fn_type;
mod test_frozen_rows_and_columns;
mod test_geomean;

View File

@@ -0,0 +1,15 @@
#![allow(clippy::unwrap_used)]
use crate::test::util::new_empty_model;
#[test]
fn fn_round_approximation() {
let mut model = new_empty_model();
model._set("A1", "=ROUND(1.05*(0.0284+0.0046)-0.0284,4)");
model._set("A2", "=ROUNDDOWN(1.05*(0.0284+0.0046)-0.0284,5)");
model.evaluate();
assert_eq!(model._get_text("A1"), *"0.0063");
assert_eq!(model._get_text("A2"), *"0.00625");
}