Kaydet (Commit) 8c414b6f authored tarafından Eike Rathke's avatar Eike Rathke

dr78: #i91870# PMT accuracy; patch from <regina>

# HG changeset patch
# User Eike Rathke [er] <eike.rathke@oracle.com>
# Date 1291388863 -3600
# Node ID 4ca136c3f3c8eb330664884c2ff79e2027d8e4eb
# Parent  c2bc2890eae42a85c3f16085f9d7867799554839
üst cdbcb1a0
......@@ -1120,24 +1120,23 @@ void ScInterpreter::ScLIA()
}
}
double ScInterpreter::ScGetRmz(double fZins, double fZzr, double fBw,
double fZw, double fF)
double ScInterpreter::ScGetRmz(double fRate, double fNper, double fPv,
double fFv, double fPaytype)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetRmz" );
double fRmz;
if (fZins == 0.0)
fRmz = (fBw + fZw) / fZzr;
double fPayment;
if (fRate == 0.0)
fPayment = (fPv + fFv) / fNper;
else
{
double fTerm = pow(1.0 + fZins, fZzr);
if (fF > 0.0)
fRmz = (fZw * fZins / (fTerm - 1.0)
+ fBw * fZins / (1.0 - 1.0 / fTerm)) / (1.0+fZins);
else
fRmz = fZw * fZins / (fTerm - 1.0)
+ fBw * fZins / (1.0 - 1.0 / fTerm);
if (fPaytype > 0.0) // payment in advance
fPayment = (fFv + fPv * exp( fNper * ::rtl::math::log1p(fRate) ) ) * fRate /
(::rtl::math::expm1( (fNper + 1) * ::rtl::math::log1p(fRate) ) - fRate);
else // payment in arrear
fPayment = (fFv + fPv * exp(fNper * ::rtl::math::log1p(fRate) ) ) * fRate /
::rtl::math::expm1( fNper * ::rtl::math::log1p(fRate) );
}
return -fRmz;
return -fPayment;
}
void ScInterpreter::ScRMZ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment