Merge branch 'develop' of https://github.com/PHPOffice/PhpSpreadsheet into develop

This commit is contained in:
MarkBaker 2016-08-13 11:50:02 +01:00
commit 3886999957
12 changed files with 225 additions and 233 deletions

View File

@ -1022,9 +1022,11 @@ class Engineering
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);
@ -1106,9 +1108,11 @@ class Engineering
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);
@ -1327,12 +1331,16 @@ class Engineering
if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) {
return Functions::VALUE();
}
$x = (string)floor($x);
if ($x < -512 || $x > 511) {
return Functions::NAN();
}
$r = decbin($x);
if (strlen($r) == 32) {
// Two's Complement
$r = substr($r, -10);
} elseif (strlen($r) >= 11) {
// Two's Complement
$r = substr($r, -10);
if (strlen($r) >= 11) {
return Functions::NAN();
}
@ -1491,11 +1499,8 @@ class Engineering
if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) {
return Functions::NAN();
}
if (hexdec($x) > 0x1FF) {
return Functions::NAN();
}
$binVal = decbin(hexdec($x));
return substr(self::nbrConversionFormat($binVal, $places), -10);
return self::DECTOBIN(self::HEXTODEC($x), $places);
}
@ -1529,9 +1534,14 @@ class Engineering
if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) {
return Functions::NAN();
}
if (strlen($x)> 10) {
return Functions::NAN();
}
$binX = '';
foreach (str_split($x) as $char) {
$binX .= str_pad(base_convert($char, 16, 2), 3, '0', STR_PAD_LEFT);
$binX .= str_pad(base_convert($char, 16, 2), 4, '0', STR_PAD_LEFT);
}
if (strlen($binX) == 40 && $binX[0] == '1') {
for ($i = 0; $i < 40; $i++) {
@ -1587,12 +1597,15 @@ class Engineering
if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) {
return Functions::NAN();
}
$octVal = decoct(hexdec($x));
return self::nbrConversionFormat($octVal, $places);
$decimal = self::HEXTODEC($x);
if ($decimal < -536870912 || $decimal > 536870911) {
return Functions::NAN();
}
return self::DECTOOCT($decimal, $places);
}
/**
* OCTTOBIN
*
@ -1639,9 +1652,8 @@ class Engineering
if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) {
return Functions::NAN();
}
$r = decbin(octdec($x));
return self::nbrConversionFormat($r, $places);
return self::DECTOBIN(self::OCTTODEC($x), $places);
}

View File

@ -30,7 +30,6 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider providerBESSELI
* @group fail19
*/
public function testBESSELI()
{
@ -47,7 +46,6 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider providerBESSELJ
* @group fail19
*/
public function testBESSELJ()
{
@ -64,7 +62,6 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider providerBESSELK
* @group fail19
*/
public function testBESSELK()
{
@ -81,7 +78,6 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider providerBESSELY
* @group fail19
*/
public function testBESSELY()
{
@ -228,7 +224,6 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider providerIMEXP
* @group fail19
*/
public function testIMEXP()
{
@ -472,7 +467,6 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider providerDEC2BIN
* @group fail19
*/
public function testDEC2BIN()
{
@ -521,7 +515,6 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider providerHEX2BIN
* @group fail19
*/
public function testHEX2BIN()
{
@ -538,7 +531,6 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider providerHEX2DEC
* @group fail19
*/
public function testHEX2DEC()
{
@ -555,7 +547,6 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider providerHEX2OCT
* @group fail19
*/
public function testHEX2OCT()
{
@ -572,7 +563,6 @@ class EngineeringTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider providerOCT2BIN
* @group fail19
*/
public function testOCT2BIN()
{

View File

@ -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, 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, -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
-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, 1.0477785626593200E+08
21, 2, 104777847.71856035

View File

@ -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
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, -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
-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

View File

@ -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
0.1, 3, 7990.01243278
1, 0, 0.42102444
1.5, 0, 0.21380557
-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, 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, 2.8501970000186900E+01
1.5, 1, 2.7738780363225900E-01
2.5, 1, 7.3890815650266900E-02
3.5, 1, 2.2239393224640700E-02
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.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
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

View File

@ -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
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!"
0.035, 1, -1.8233338940000000E+01
1.5, 1, -4.1230862700000000E-01
2.5, 1, 1.4591813800000000E-01
3.5, 1, 4.1018841700000000E-01
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.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
0.9, 2, -1.94590960
1.9, 2, -0.66987868
3.5, 2, 0.04537144
4, 5, -0.79585142

View File

@ -1,5 +1,6 @@
357, "101100101"
1357, "#NUM!" // Too large
512, "#NUM!" // Too large
-513, "#NUM!" // Too small
9, 4, "1001"
9, 8, "00001001"
9, 6.75, "001001" // Leading places as a float
@ -14,3 +15,4 @@
TRUE, "#VALUE!" // Non string
-100, "1110011100" // 2's Complement
-107, "1110010101" // 2's Complement
-512, "1000000000" // 2's Complement

View File

@ -1,3 +1,8 @@
"FF", "11111111"
"1FF", "111111111"
"200", "#NUM!"
"FFFFFFFE00", "1000000000" // 2's Complement
"FFFFFFFDFF", "#NUM!" // 2's Complement
"01AB", "110101011"
"ABCD", "#NUM!"
"F6", "11110110"
@ -10,4 +15,3 @@
"G3579A", "#NUM!"
TRUE, "#VALUE!"
"-107", "#NUM!"
"FFFFFFFFFF", "1111111111" // 2's Complement

View File

@ -9,5 +9,7 @@
TRUE, "#VALUE!"
"-107", "#NUM!"
"A5", "165"
"FFFFFFFF5B", "-165"
"3DA408B9", "1034160313" // 2's Complement
"3DA408B9", "1034160313"
"FFFFFFFF5B", "-165" // 2's Complement
"FFFFFFFFFF", "-1" // 2's Complement
"1FFFFFFFFFF", "#NUM!" // Too large

View File

@ -1,5 +1,5 @@
"12.34+5.67j", "187004.11273906-131589.323796073j"
"-12.34E-5+6.78E9i", "1.79747131321615E+308+1.79747131321615E+308i"
"-12.34E-5+6.78E9i", "0.519482808316086+0.85433649244115i"
"3.5+2.5i", "-26.5302329126575+19.8186755366902i"
"3.5+i", "17.8923550531471+27.8656919720394i"
"3.5", "33.1154519586923"

View File

@ -7,3 +7,7 @@
TRUE, "#VALUE!"
"3579", "#NUM!"
"7777777000", "1000000000" // 2's Complement
"7777777777", "1111111111" // 2's Complement
"17777777777", "#NUM!" // Too small
"777", "111111111"
"1777", "#NUM!" // Too large

View File

@ -1,7 +1,7 @@
#Issue date 1st Interest Settlement Rate Par Freq Basis Result
"2008-03-01", "2008-08-31", "2008-05-01", 0.10, 1000, 2, 0, 16.666666666667
"2008-03-05", "2008-08-31", "2008-05-01", 0.10, 1000, 2, 0, 15.555555555556
"2010-01-01", "2010-06-30", "2010-04-01", 0.08, 10000, 4, 202.222222222222
"2010-01-01", "2010-06-30", "2010-04-01", 0.08, 10000, 4, 200
"2008-03-05", "2008-08-31", "2008-05-01", -0.10, 1000, 2, 0, "#NUM!"
"Invalid Date", "2008-08-31", "2008-05-01", 0.10, 1000, 2, 0, "#VALUE!"
"2008-03-01", "2008-08-31", "2008-05-01", "ABC", 1000, 2, 0, "#VALUE!"