Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/ExcelFinancialFunctions/testpreconditions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ module internal TestPreconditions =
( pmt <> 0. || fv <> 0. )
let tryFv r nper pmt pv pd =
( raisable r nper) &&
( r <> -1. || (r = -1. && nper > 0.) ) &&
( pmt <> 0. || pv <> 0. )
( r <> -1. || (r = -1. && nper > 0.) )
let tryPmt r nper pv fv pd =
( raisable r nper) &&
( r > -1. ) &&
( fv <> 0. || pv <> 0. ) &&
( annuityCertainPvFactor r nper pd <> 0. )
let tryNper r pmt pv fv pd =
( r > -1.) &&
Expand Down
2 changes: 0 additions & 2 deletions src/ExcelFinancialFunctions/tvm.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ module internal Tvm =
let calcFv r nper pmt pv pd =
( raisable r nper) |> elseThrow "r is not raisable to nper (r is negative and nper not an integer"
( r <> -1. || (r = -1. && nper > 0.) ) |> elseThrow "r cannot be -100% when nper is <= 0"
( pmt <> 0. || pv <> 0. ) |> elseThrow "pmt or pv need to be different from 0"
if r = -1. && pd = PaymentDue.BeginningOfPeriod then - (pv * fvFactor r nper)
elif r = -1. && pd = PaymentDue.EndOfPeriod then - (pv * fvFactor r nper + pmt)
else fv r nper pmt pv pd
let calcPmt r nper pv fv pd =
( raisable r nper) |> elseThrow "r is not raisable to nper (r is negative and nper not an integer"
( fv <> 0. || pv <> 0. ) |> elseThrow "fv or pv need to be different from 0"
( r <> -1. || (r = -1. && nper > 0. && pd = PaymentDue.EndOfPeriod) ) |> elseThrow "r cannot be -100% when nper is <= 0"
( annuityCertainPvFactor r nper pd <> 0. ) |> elseThrow "1 * pd + 1 - (1 / (1 + r)^nper) / nper has to be <> 0"
if r = -1. then -fv
Expand Down