Why Does Delphi's Math.Payment Function Return A Negative Number
-
20-09-2019 - |
Question
I'm trying to calculate the monthly payment for the following scenario:
$5,000 is borrowed for 3 years at 8.00% compounded monthly with $1,000 due at the end of the term.
/*
From Math.pas
function Payment(Rate: Extended;
NPeriods: Integer;
const PresentValue: Extended;
const FutureValue: Extended;
PaymentTime: TPaymentTime): Extended;
*/
var
Pmt : Extended;
begin
Pmt := Payment(0.08/12,36,5000,1000,ptEndOfPeriod);
Edit1.Text := FloatToStr(Pmt);
end
Result = -181.351526101918
The result is correct except it is negative.
Why does the result of the Payment function return a negative number?
Solution
The negative value is expected. If you run Excel's PMT function you will see the same result.
The function balances between the direction the money is going. The negative sign means you are paying money out against the money borrowed (the positive values in the function call). If you switch to negative values in the function (i.e. -5000 and -1000) then the result will be positive.
OTHER TIPS
Since you borrowed the money, could you try with **-**5000 and **-**1000?
For 5000 to become 1000, you have to take something away, not add to it. Since you are paying and not receiving, you should expect an negative amount.