38 $type = FinancialConstants::PAYMENT_END_OF_PERIOD
53 return $e->getMessage();
56 return self::calculateFutureValue($rate, $numberOfPeriods, $payment, $presentValue,
$type);
77 $type = FinancialConstants::PAYMENT_END_OF_PERIOD
92 return $e->getMessage();
96 if ($numberOfPeriods < 0) {
100 return self::calculatePresentValue($rate, $numberOfPeriods, $payment, $futureValue,
$type);
121 $type = FinancialConstants::PAYMENT_END_OF_PERIOD
136 return $e->getMessage();
140 if ($payment == 0.0) {
144 return self::calculatePeriods($rate, $payment, $presentValue, $futureValue,
$type);
149 int $numberOfPeriods,
154 if ($rate !== null && $rate != 0) {
155 return -$presentValue *
156 (1 + $rate) ** $numberOfPeriods - $payment * (1 + $rate * $type) * ((1 + $rate) ** $numberOfPeriods - 1)
160 return -$presentValue - $payment * $numberOfPeriods;
165 int $numberOfPeriods,
171 return (-$payment * (1 + $rate * $type)
172 * (((1 + $rate) ** $numberOfPeriods - 1) / $rate) - $futureValue) / (1 + $rate) ** $numberOfPeriods;
175 return -$futureValue - $payment * $numberOfPeriods;
189 if ($presentValue == 0.0) {
193 return log(($payment * (1 + $rate * $type) / $rate - $futureValue) /
194 ($presentValue + $payment * (1 + $rate * $type) / $rate)) / log(1 + $rate);
197 return (-$presentValue - $futureValue) / $payment;
static presentValue( $rate, $numberOfPeriods, $payment=0.0, $futureValue=0.0, $type=FinancialConstants::PAYMENT_END_OF_PERIOD)
PV.
static futureValue( $rate, $numberOfPeriods, $payment=0.0, $presentValue=0.0, $type=FinancialConstants::PAYMENT_END_OF_PERIOD)
FV.
static validatePresentValue($presentValue)
static validateRate($rate)
static validatePeriodType($type)
static calculateFutureValue(float $rate, int $numberOfPeriods, float $payment, float $presentValue, int $type)
static validateFutureValue($futureValue)
static calculatePeriods(float $rate, float $payment, float $presentValue, float $futureValue, int $type)
static periods( $rate, $payment, $presentValue, $futureValue=0.0, $type=FinancialConstants::PAYMENT_END_OF_PERIOD)
NPER.
static validateFloat($value)
static validateInt($value)
static calculatePresentValue(float $rate, int $numberOfPeriods, float $payment, float $futureValue, int $type)
static flattenSingleValue($value='')
Convert an array to a single scalar value by extracting the first element.