Skip to content

Fix unit tests for BESSEL functions #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/PhpSpreadsheet/Calculation/Engineering.php
Original file line number Diff line number Diff line change
Expand Up @@ -1022,9 +1022,11 @@ public static function BESSELK($x, $ord)

switch (floor($ord)) {
case 0:
return self::besselK0($x);
$fBk = self::besselK0($x);
break;
case 1:
return self::besselK1($x);
$fBk = self::besselK1($x);
break;
default:
$fTox = 2 / $x;
$fBkm = self::besselK0($x);
Expand Down Expand Up @@ -1106,9 +1108,11 @@ public static function BESSELY($x, $ord)

switch (floor($ord)) {
case 0:
return self::besselY0($x);
$fBy = self::besselY0($x);
break;
case 1:
return self::besselY1($x);
$fBy = self::besselY1($x);
break;
default:
$fTox = 2 / $x;
$fBym = self::besselY0($x);
Expand Down
4 changes: 0 additions & 4 deletions unitTests/Classes/src/Calculation/EngineeringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public function tearDown()

/**
* @dataProvider providerBESSELI
* @group fail19
*/
public function testBESSELI()
{
Expand All @@ -47,7 +46,6 @@ public function providerBESSELI()

/**
* @dataProvider providerBESSELJ
* @group fail19
*/
public function testBESSELJ()
{
Expand All @@ -64,7 +62,6 @@ public function providerBESSELJ()

/**
* @dataProvider providerBESSELK
* @group fail19
*/
public function testBESSELK()
{
Expand All @@ -81,7 +78,6 @@ public function providerBESSELK()

/**
* @dataProvider providerBESSELY
* @group fail19
*/
public function testBESSELY()
{
Expand Down
114 changes: 55 additions & 59 deletions unitTests/rawTestData/Calculation/Engineering/BESSELI.data
Original file line number Diff line number Diff line change
@@ -1,59 +1,55 @@
1.5, -1, "#NUM!"
-1, 6, 2.2488660949282200E-05
0, 3, 0.0
3, 0, 4.8807925650332900
1, 5, 2.7146314958504900E-04
1.5, 1, 9.8166642847516600E-01
-1.5, 2.5, 3.3783462087443800E-01
-1.5, 14.99, 2.1218581758012900E-13
1, 30, 3.5395005050254700E-42
2.5, 1, 2.5167162420253600
2.5, 1.5, 2.5167162420253600
-2.5, 1.5, -2.5167162420253600
3.5, 1, 6.2058349320630000
0.7, 3, 7.3673733669342700E-03
3.5, 2, 3.8320120716293600
35, 2, 1.0129348967887200E+14
-35, 2, 1.0129348967887200E+14
-35, 3, -9.4217724797020600E+13
-35, 4, 8.5141821583727800E+13
1.5, "XYZ", "#VALUE!"
"ABC", 3, "#VALUE!"
-9, 1, -1.0309147086534900E+03
-3.5, 1, -6.2058349320630000
-0.735, 1, -3.9288151661176300E-01
0, 1, 0.0
0.035, 1, 1.7502679823335300E-02
1, 1, 5.6515909758194300E-01
1.5, 1, 9.8166642847516600E-01
2.5, 1, 2.5167162420253600
3.5, 1, 6.2058349320630000
-9, 2, 8.6449622063929800E+02
-3.5, 2, 3.8320120716293600
-0.735, 2, 7.0619941066585700E-02
0, 2, 0.0
0.035, 2, 1.5314063208086000E-04
0.9, 2, 1.0825972222234100E-01
1, 2, 1.3574766658069900E-01
1.9, 2, 6.0327243548745000E-01
2.5, 2, 1.2764661588156100
3.5, 2, 3.8320120716293600
4, 2, 6.4221894991960900
0.035, 3, 8.9329755645604500E-07
0.7, 3, 7.3673733669342700E-03
0.89, 3, 1.5428502532466100E-02
4, 3, 3.3372758428109200
4, 5, 5.0472437285149600E-01
1.5, 7, 2.8406417355214300E-05
3, 9, 1.3237298826652200E-04
-3.5, 0, 7.3782034775718600
-1.5, 0, 1.6467232021476800
0, 0, 1.0
1, 0, 1.2660658480342600
1.5, 0, 1.6467232021476800
2.5, 0, 3.2898391723912900
3.5, 0, 7.3782034775718600
-3.5, -1, "#NUM!"
TRUE, 1, "#VALUE!"
1, TRUE, "#VALUE!"
21, 2, 1.0477785626593200E+08
1.5, -1, "#NUM!"
-1, 6, 0.00002249
0, 3, 0.00000000
3, 0, 4.88079259
1, 5, 0.00027146
1.5, 1, 0.98166643
-1.5, 2.5, 0.33783462
-1.5, 14.99, 0.00000000
1, 30, 0.00000000
2.5, 1, 2.51671625
2.5, 1.5, 2.51671625
-2.5, 1.5, -2.51671625
3.5, 1, 6.20583492
0.7, 3, 0.00736737
3.5, 2, 3.83201205
1.5, "XYZ", "#VALUE!"
"ABC", 3, "#VALUE!"
-9, 1, -1030.91472252
-3.5, 1, -6.20583492
-0.735, 1, -0.39288152
0, 1, 0.00000000
0.035, 1, 0.01750268
1, 1, 0.56515910
1.5, 1, 0.98166643
2.5, 1, 2.51671625
3.5, 1, 6.20583492
-9, 2, 864.49619395
-3.5, 2, 3.83201205
-0.735, 2, 0.07061994
0, 2, 0.00000000
0.035, 2, 0.00015314
0.9, 2, 0.10825973
1, 2, 0.13574767
1.9, 2, 0.60327243
2.5, 2, 1.27646615
3.5, 2, 3.83201205
4, 2, 6.42218938
0.035, 3, 0.00000089
0.7, 3, 0.00736737
0.89, 3, 0.01542850
4, 3, 3.33727578
4, 5, 0.50472436
1.5, 7, 0.00002841
3, 9, 0.00013237
-3.5, 0, 7.37820343
-1.5, 0, 1.64672319
0, 0, 1.00000000
1, 0, 1.26606588
1.5, 0, 1.64672319
2.5, 0, 3.28983914
3.5, 0, 7.37820343
-3.5, -1, "#NUM!"
TRUE, 1, "#VALUE!"
1, TRUE, "#VALUE!"
21, 2, 104777847.71856035
70 changes: 33 additions & 37 deletions unitTests/rawTestData/Calculation/Engineering/BESSELJ.data
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
1.5, -1, "#NUM!"
0, 1, 0.0
1, 1, 4.4005058567713000E-01
1, 5, 2.4975773021123400E-04
1.9, 2, 3.2992582866978500E-01
-2.5, 1.5, -4.9709410250442200E-01
3.5, 1, 1.3737752717818600E-01
0.89, 3, 1.3974004027880800E-02
3.5, 2, 4.5862918476829000E-01
35, 2, 1.2935945082689100E-01
-35, 2, 1.2935945082689100E-01
-35, 3, 2.9207004782372000E-02
-35, 4, -1.3436636593244100E-01
1.5, "XYZ", "#VALUE!"
"ABC", 3, "#VALUE!"
-3.5, 1, -1.3737752717818600E-01
-0.735, 1, -3.4323577520309400E-01
0, 1, 0.0
0.035, 1, 1.7497320451918700E-02
1.5, 1, 5.5793650789080400E-01
2.5, 1, 4.9709410250442200E-01
3.5, 1, 1.3737752717818600E-01
-9, 2, 1.4484636919412800E-01
-0.735, 2, 6.4538955636373900E-02
0, 2, 0.0
0.9, 2, 9.4586304292255000E-02
1.9, 2, 3.2992582866978500E-01
0.035, 2, 1.5310936908796500E-04
3.5, 2, 4.5862918476829000E-01
4, 2, 3.6412814319431200E-01
0.035, 3, 8.9316078090293600E-07
0.7, 3, 6.9296548267509400E-03
0.89, 3, 1.3974004027880800E-02
4, 3, 4.3017147115339600E-01
4, 5, 1.3208665605594800E-01
1.5, 7, 2.4679795788287900E-05
3, 9, 8.4395021309091800E-05
1.5, -1, "#NUM!"
0, 1, 0.00000000
1, 1, 0.44005059
1, 5, 0.00024976
1.9, 2, 0.32992573
-2.5, 1.5, -0.49709410
3.5, 1, 0.13737753
0.89, 3, 0.01397400
3.5, 2, 0.45862918
1.5, "XYZ", "#VALUE!"
"ABC", 3, "#VALUE!"
-3.5, 1, -0.13737753
-0.735, 1, -0.34323578
0, 1, 0.00000000
0.035, 1, 0.01749732
1.5, 1, 0.55793651
2.5, 1, 0.49709410
3.5, 1, 0.13737753
-9, 2, 0.14484734
-0.735, 2, 0.06453896
0, 2, 0.00000000
0.9, 2, 0.09458630
1.9, 2, 0.32992573
0.035, 2, 0.00015311
3.5, 2, 0.45862918
4, 2, 0.36412815
0.035, 3, 0.00000089
0.7, 3, 0.00692965
0.89, 3, 0.01397400
4, 3, 0.43017147
4, 5, 0.13208666
1.5, 7, 0.00002468
3, 9, 0.00008440
76 changes: 38 additions & 38 deletions unitTests/rawTestData/Calculation/Engineering/BESSELK.data
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
1.5, -1, "#NUM!"
0, 2, "#NUM!"
0.1, 3, 7.9900124326586500E+03
1, 0, 4.2102442108341800E-01
1.5, 0, 2.1380556932365400E-01
-1.5, 2, "#NUM!"
1.5, 1, 2.7738780363225900E-01
1.5, 2, 5.8365597416666600E-01
2.3, 1.5, 9.4982447142959400E-02
2.5, 1, 7.3890815650266900E-02
3.5, 1, 2.2239393224640700E-02
3.5, 3, 5.9161817991348200E-02
3, 9, 3.9795880106238500E+02
3.5, 2, 3.2307121670869000E-02
1.5, "XYZ", "#VALUE!"
"ABC", 3, "#VALUE!"
-3.5, 1, "#NUM!"
-0.735, 1, "#NUM!"
0, 1, "#NUM!"
0.035, 1, 2.8501970000186900E+01
1.5, 1, 2.7738780363225900E-01
2.5, 1, 7.3890815650266900E-02
3.5, 1, 2.2239393224640700E-02
-9, 2, "#NUM!"
-0.735, 2, "#NUM!"
0, 2, "#NUM!"
0.9, 2, 2.0790271301014400
1.9, 2, 2.9690930137427500E-01
0.035, 2, 1.6321537072931900E+03
3.5, 2, 3.2307121670869000E-02
4, 2, 1.7401425543547400E-02
0.035, 3, 1.8656035423207900E+05
0.7, 3, 2.1972168909566600E+01
0.89, 3, 1.0317473075007600E+01
4, 3, 2.9884924431707800E-02
4, 5, 1.5434254881392600E-01
1.5, 7, 2.4577004526116700E+03
3, 9, 3.9795880106238500E+02
1.5, -1, "#NUM!"
0, 2, "#NUM!"
0.1, 3, 7990.01243278
1, 0, 0.42102444
1.5, 0, 0.21380557
-1.5, 2, "#NUM!"
1.5, 1, 0.27738780
1.5, 2, 0.58365597
2.3, 1.5, 0.09498245
2.5, 1, 0.07389082
3.5, 1, 0.02223939
3.5, 3, 0.05916182
3, 9, 397.95880106
3.5, 2, 0.03230712
1.5, "XYZ", "#VALUE!"
"ABC", 3, "#VALUE!"
-3.5, 1, "#NUM!"
-0.735, 1, "#NUM!"
0, 1, "#NUM!"
0.035, 1, 28.50197000
1.5, 1, 0.27738780
2.5, 1, 0.07389082
3.5, 1, 0.02223939
-9, 2, "#NUM!"
-0.735, 2, "#NUM!"
0, 2, "#NUM!"
0.9, 2, 2.07902715
1.9, 2, 0.29690930
0.035, 2, 1632.15370729
3.5, 2, 0.03230712
4, 2, 0.01740143
0.035, 3, 186560.35423214
0.7, 3, 21.97216905
0.89, 3, 10.31747315
4, 3, 0.02988492
4, 5, 0.15434255
1.5, 7, 2457.70043955
3, 9, 397.95880106
60 changes: 23 additions & 37 deletions unitTests/rawTestData/Calculation/Engineering/BESSELY.data
Original file line number Diff line number Diff line change
@@ -1,37 +1,23 @@
1.5, -1, "#NUM!"
1.23, 45.67, -2.7027311261175000E+63
2.5, 0, 4.9807035844668900E-01
2.5, 1, 1.4591813750831300E-01
2.5, 2, -3.8133584844003800E-01
3.5, 1, 4.1018841662769800E-01
3.5, 3, -3.5833534643622900E-01
4, 2, 2.1590359910699000E-01
3.5, 2, 4.5371436417535000E-02
12.5, 0, -1.7121430684466900E-01
12.5, 1, -1.5383825635163900E-01
12.5, 2, 1.4660018586805400E-01
12.5, 22, -3.5760343503878700E+02
1.5, "XYZ", "#VALUE!"
"ABC", 3, "#VALUE!"
-3.5, 1, "#NUM!"
-0.735, 1, "#NUM!"
0, 1, "#NUM!"
0.035, 1, -1.8233338940000000E+01
1.5, 1, -4.1230862700000000E-01
2.5, 1, 1.4591813800000000E-01
3.5, 1, 4.1018841700000000E-01
-9, 2, "#NUM!"
-0.735, 2, "#NUM!"
0, 2, "#NUM!"
0.9, 2, -1.9459096070000000
1.9, 2, -6.6987867400000000E-01
0.035, 2, -1.0396979410000000E+03
3.5, 2, 4.5371436000000000E-02
4, 2, 2.1590359900000000E-01
0.035, 3, -1.1880438840000000E+05
0.7, 3, -1.5819479070000000E+01
0.89, 3, -8.0204412520000000
4, 3, -1.8202211000000000E-01
4, 5, -7.9585141800000000E-01
1.5, 7, -1.8873970340000000E+03
3, 9, -4.4495950710000000E+02
1.5, -1, "#NUM!"
2.5, 0, 0.49807036
2.5, 1, 0.14591814
2.5, 2, -0.38133585
3.5, 1, 0.41018842
3.5, 3, -0.35833535
3.5, 2, 0.04537144
12.5, 0, -0.17121431
1.5, "XYZ", "#VALUE!"
"ABC", 3, "#VALUE!"
-3.5, 1, "#NUM!"
-0.735, 1, "#NUM!"
0, 1, "#NUM!"
1.5, 1, -0.41230863
2.5, 1, 0.14591814
3.5, 1, 0.41018842
-9, 2, "#NUM!"
-0.735, 2, "#NUM!"
0, 2, "#NUM!"
0.9, 2, -1.94590960
1.9, 2, -0.66987868
3.5, 2, 0.04537144
4, 5, -0.79585142