Files
PhpSpreadsheet/tests/data/Calculation/MathTrig/POWER.php
T
oleibman f8d994b6e7 POWER Needs to Accept NULL Args
Investigating issue #1622, I found that its extremely complicated formula, which had been leading to an incorrect result, now led to an exception. I am able to fix the exception; unfortunately, I am no closer to resolving the original issue. So I'll apply the baby step while continuing to investigate. Function POWER had changed from untyped args to a defined set of types. The set of types was determined according to the doc block, but that was incomplete - it had neglected to include `null` and `bool`. This PR corrects the function prototype and the doc block, and adds the missing tests for those conditions.
2024-05-16 00:25:47 -07:00

419 lines
5.1 KiB
PHP

<?php
declare(strict_types=1);
return [
[
'#NUM!',
-1.5,
-1.5,
],
[
'#NUM!',
-0.75,
-1.5,
],
[
'#DIV/0!',
0,
-1.5,
],
[
1.5396007178390001,
0.75,
-1.5,
],
[
0.54433105395182002,
1.5,
-1.5,
],
[
0.2962962962963,
2.25,
-1.5,
],
[
0.19245008972988001,
3,
-1.5,
],
[
0.13770607453181999,
3.75,
-1.5,
],
[
0.10475656017579001,
4.5,
-1.5,
],
[
'#NUM!',
-1.5,
-0.75,
],
[
'#NUM!',
-0.75,
-0.75,
],
[
'#DIV/0!',
0,
-0.75,
],
[
1.2408064788027999,
0.75,
-0.75,
],
[
0.73778794646687995,
1.5,
-0.75,
],
[
0.54433105395182002,
2.25,
-0.75,
],
[
0.43869133765083002,
3,
-0.75,
],
[
0.37108769116182999,
3.75,
-0.75,
],
[
0.32366118113822001,
4.5,
-0.75,
],
[
1,
-1.5,
0,
],
[
1,
-0.75,
0,
],
[
'#NUM!',
0,
0,
],
[
1,
0.75,
0,
],
[
1,
1.5,
0,
],
[
1,
2.25,
0,
],
[
1,
3,
0,
],
[
1,
3.75,
0,
],
[
1,
4.5,
0,
],
[
'#NUM!',
-1.5,
0.75,
],
[
'#NUM!',
-0.75,
0.75,
],
[
0,
0,
0.75,
],
[
0.80592744886765999,
0.75,
0.75,
],
[
1.3554030054147701,
1.5,
0.75,
],
[
1.8371173070873801,
2.25,
0.75,
],
[
2.2795070569547802,
3,
0.75,
],
[
2.6947808397231299,
3.75,
0.75,
],
[
3.0896507158606799,
4.5,
0.75,
],
[
'#NUM!',
-1.5,
1.5,
],
[
'#NUM!',
-0.75,
1.5,
],
[
0,
0,
1.5,
],
[
0.64951905283833,
0.75,
1.5,
],
[
1.8371173070873801,
1.5,
1.5,
],
[
3.375,
2.25,
1.5,
],
[
5.1961524227066302,
3,
1.5,
],
[
7.2618437741389101,
3.75,
1.5,
],
[
9.5459415460183905,
4.5,
1.5,
],
[
'#NUM!',
-1.5,
2.25,
],
[
'#NUM!',
-0.75,
2.25,
],
[
0,
0,
2.25,
],
[
0.52346523324492999,
0.75,
2.25,
],
[
2.4900343193257202,
1.5,
2.25,
],
[
6.2002709114199197,
2.25,
2.25,
],
[
11.8446661165724,
3,
2.25,
],
[
19.569077463612199,
3.75,
2.25,
],
[
29.4936251312199,
4.5,
2.25,
],
[
-3.375,
-1.5,
3,
],
[
-0.421875,
-0.75,
3,
],
[
0,
0,
3,
],
[
0.421875,
0.75,
3,
],
[
3.375,
1.5,
3,
],
[
11.390625,
2.25,
3,
],
[
27,
3,
3,
],
[
52.734375,
3.75,
3,
],
[
91.125,
4.5,
3,
],
[
'#NUM!',
-1.5,
3.75,
],
[
'#NUM!',
-0.75,
3.75,
],
[
0,
0,
3.75,
],
[
0.34000064249104001,
0.75,
3.75,
],
[
4.5744851432748401,
1.5,
3.75,
],
[
20.9259143260422,
2.25,
3.75,
],
[
61.546690537779,
3,
3.75,
],
[
142.10758334477501,
3.75,
3.75,
],
[
281.54442148280401,
4.5,
3.75,
],
[
'#NUM!',
-1.5,
4.5,
],
[
'#NUM!',
-0.75,
4.5,
],
[
0,
0,
4.5,
],
[
0.27401585041616999,
0.75,
4.5,
],
[
6.2002709114199197,
1.5,
4.5,
],
[
38.443359375,
2.25,
4.5,
],
[
140.29611541307901,
3,
4.5,
],
[
382.94879277685698,
3.75,
4.5,
],
[
869.87392338092604,
4.5,
4.5,
],
['#VALUE!', 'x', 2],
['#VALUE!', 2, 'x'],
'exponent is null' => [1, 2, null],
'base is null' => [0, null, 2],
'both null' => ['#NUM!', null, null],
'exponent is bool' => [2, 2, true],
'base is bool' => [0, false, 2],
];