FIX: Several fixes on the FV function

(1+x)^(1+y) was stringifyfied incorrectly
We still need work on this

FV now returns currency

FV(-1,-2,1) should return #DIV/0! not #NUM!
This commit is contained in:
Nicolás Hatcher
2024-12-04 19:41:03 +01:00
committed by Nicolás Hatcher Andrés
parent 8c6aaf2af0
commit 23814ec18c
15 changed files with 155 additions and 42 deletions

View File

@@ -89,6 +89,9 @@ fn compute_future_value(
if rate == 0.0 {
return Ok(-pv - pmt * nper);
}
if rate == -1.0 && nper < 0.0 {
return Err((Error::DIV, "Divide by zero".to_string()));
}
let rate_nper = (1.0 + rate).powf(nper);
let fv = if period_start {