Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么Delphi的Math.Payment函数返回负数_Delphi_Math_Delphi 2010_Financial - Fatal编程技术网

为什么Delphi的Math.Payment函数返回负数

为什么Delphi的Math.Payment函数返回负数,delphi,math,delphi-2010,financial,Delphi,Math,Delphi 2010,Financial,我正在尝试计算以下场景的每月付款: 5000美元的借款期限为3年,每月复利8.00%,到期日为1000美元 /* From Math.pas function Payment(Rate: Extended; NPeriods: Integer; const PresentValue: Extended; const FutureValue: Extended; PaymentTime: TPaymentTime): Extended; */ var Pmt : Extended;

我正在尝试计算以下场景的每月付款:

5000美元的借款期限为3年,每月复利8.00%,到期日为1000美元

/*
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
结果=-181.351526101918 结果是正确的,只是它是否定的。
为什么付款函数的结果返回负数?

既然你借了钱,你能试着用**-**5000和**-**1000吗?

如果5000变成1000,你必须拿走一些东西,而不是增加。由于您是在付款而不是在收款,因此您应该预期为负值。

预期为负值。如果运行Excel的PMT函数,您将看到相同的结果

该函数在资金流向之间进行平衡。负号表示您正在根据函数调用中的正值借来的钱进行付款。如果在函数中切换为负值,即-5000和-1000,则结果将为正值