Skip to content

Commit c91c8c9

Browse files
authored
Merge pull request PHPOffice#4164 from oleibman/amordegrc
Tweak for AMORDEGRC
2 parents 2d493d7 + 90162a1 commit c91c8c9

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/PhpSpreadsheet/Calculation/Financial/Amortization.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
class Amortization
1111
{
12-
private const ROUNDING_ADJUSTMENT = (PHP_VERSION_ID < 80400) ? 0 : 1e-14;
13-
1412
/**
1513
* AMORDEGRC.
1614
*
@@ -82,7 +80,7 @@ public static function AMORDEGRC(
8280
$amortiseCoeff = self::getAmortizationCoefficient($rate);
8381

8482
$rate *= $amortiseCoeff;
85-
$rate += self::ROUNDING_ADJUSTMENT;
83+
$rate = (float) (string) $rate; // ugly way to avoid rounding problem
8684
$fNRate = round($yearFrac * $rate * $cost, 0);
8785
$cost -= $fNRate;
8886
$fRest = $cost - $salvage;

0 commit comments

Comments
 (0)