Files
oleibman b6ff857ba7 RATE Function Permits Floating Point NPER
Suggested by PR #848 from @markkimsal. The RATE calculation had already been corrected, so that part of the PR was unnecessary, however one of the tests included a floating point value for Number of Periods, which Excel permits. PhpSpreadsheet till now expected that parameter to be an integer. This is trivially changed with some tests added.
2024-07-22 08:32:54 -07:00

175 lines
2.3 KiB
PHP

<?php
declare(strict_types=1);
// Periods, Payment, Present Value, Future Value, Type, Guess, Result
return [
[
0.0077014724882014003,
48,
-200,
8000,
],
[
0.046781916422493401,
60,
-6000,
120000,
],
[
-0.020442952219356499,
60,
-1000,
120000,
],
[
0.015130843902343399,
24,
-250,
5000,
],
[
0.017929869399484,
24.99,
-250,
5000,
],
[
0.016581855,
24.5,
-250,
5000,
],
[
0.016550119066711999,
24,
-250,
5000,
null,
1,
],
[
0.087499997684093694,
208,
-700,
8000,
],
[
0.087113755605863596,
10,
-1000,
6500,
],
[
0.048472127283572801,
6,
-1000,
100000,
-126068,
],
[
0.030272873827543501,
6,
1000,
100000,
-126068,
],
[
0.030272873827543699,
6,
-1000,
-100000,
126068,
0,
],
[
'#NUM!',
0,
1,
8000,
],
[
'#NUM!',
208,
-700,
8000,
0,
0,
0,
],
[
-1.000125, // Excel says #NUM!, but I believe this is correct
1,
1,
8000,
],
[
6.9258100553578E-10,
208,
-700,
137600,
8000,
],
[
0.00054607632544395,
208,
-700,
137600,
],
[
'#VALUE!',
'NaN',
-700,
8000,
0,
0,
0,
],
[
'#VALUE!',
208,
'NaN',
8000,
0,
0,
0,
],
[
'#VALUE!',
208,
-700,
'NaN',
0,
0,
0,
],
[
'#VALUE!',
208,
-700,
8000,
'NaN',
0,
0,
],
[
'#VALUE!',
208,
-700,
8000,
0,
'NaN',
0,
],
[
'#VALUE!',
208,
-700,
8000,
0,
0,
'NaN',
],
];