Merge pull request #4107 from oleibman/pr848

RATE Function Permits Floating Point NPER
This commit is contained in:
oleibman
2024-07-30 22:05:12 +00:00
committed by GitHub
2 changed files with 14 additions and 2 deletions
@@ -165,7 +165,7 @@ class Interest
$guess = ($guess === null) ? 0.1 : Functions::flattenSingleValue($guess);
try {
$numberOfPeriods = CashFlowValidations::validateInt($numberOfPeriods);
$numberOfPeriods = CashFlowValidations::validateFloat($numberOfPeriods);
$payment = CashFlowValidations::validateFloat($payment);
$presentValue = CashFlowValidations::validatePresentValue($presentValue);
$futureValue = CashFlowValidations::validateFutureValue($futureValue);
@@ -193,7 +193,7 @@ class Interest
return $close ? $rate : ExcelError::NAN();
}
private static function rateNextGuess(float $rate, int $numberOfPeriods, float $payment, float $presentValue, float $futureValue, int $type): string|float
private static function rateNextGuess(float $rate, float $numberOfPeriods, float $payment, float $presentValue, float $futureValue, int $type): string|float
{
if ($rate == 0.0) {
return ExcelError::NAN();
+12
View File
@@ -29,6 +29,18 @@ return [
-250,
5000,
],
[
0.017929869399484,
24.99,
-250,
5000,
],
[
0.016581855,
24.5,
-250,
5000,
],
[
0.016550119066711999,
24,