1--TEST-- 2bcpow() function 3--EXTENSIONS-- 4bcmath 5--INI-- 6bcmath.scale=0 7--FILE-- 8<?php 9require(__DIR__ . "/run_bcmath_tests_function.inc"); 10 11$exponents = ["15", "-15", "1", "-9", "0", "-0"]; 12$baseNumbers = array_merge($exponents, [ 13 "14.14", 14 "-16.60", 15 "0.15", 16 "-0.01", 17 "15151324141414.412312232141241", 18 "141241241241241248267654747412", 19 "-149143276547656984948124912", 20 "-132132245132134.1515123765412", 21 "0.1322135476547459213732911312", 22 "-0.123912932193769965476541321", 23]); 24 25run_bcmath_tests($baseNumbers, $exponents, "**", bcpow(...)); 26 27?> 28--EXPECT-- 29Number "15" (scale 0) 3015 ** 15 = 437893890380859375 3115 ** -15 = 0 3215 ** 1 = 15 3315 ** -9 = 0 3415 ** 0 = 1 3515 ** -0 = 1 36 37Number "-15" (scale 0) 38-15 ** 15 = -437893890380859375 39-15 ** -15 = 0 40-15 ** 1 = -15 41-15 ** -9 = 0 42-15 ** 0 = 1 43-15 ** -0 = 1 44 45Number "1" (scale 0) 461 ** 15 = 1 471 ** -15 = 1 481 ** 1 = 1 491 ** -9 = 1 501 ** 0 = 1 511 ** -0 = 1 52 53Number "-9" (scale 0) 54-9 ** 15 = -205891132094649 55-9 ** -15 = 0 56-9 ** 1 = -9 57-9 ** -9 = 0 58-9 ** 0 = 1 59-9 ** -0 = 1 60 61Number "0" (scale 0) 620 ** 15 = 0 630 ** -15 = Negative power of zero 640 ** 1 = 0 650 ** -9 = Negative power of zero 660 ** 0 = 1 670 ** -0 = 1 68 69Number "-0" (scale 0) 70-0 ** 15 = 0 71-0 ** -15 = Negative power of zero 72-0 ** 1 = 0 73-0 ** -9 = Negative power of zero 74-0 ** 0 = 1 75-0 ** -0 = 1 76 77Number "14.14" (scale 0) 7814.14 ** 15 = 180609729388653367 7914.14 ** -15 = 0 8014.14 ** 1 = 14 8114.14 ** -9 = 0 8214.14 ** 0 = 1 8314.14 ** -0 = 1 84 85Number "-16.60" (scale 0) 86-16.60 ** 15 = -2002725006700243463 87-16.60 ** -15 = 0 88-16.60 ** 1 = -16 89-16.60 ** -9 = 0 90-16.60 ** 0 = 1 91-16.60 ** -0 = 1 92 93Number "0.15" (scale 0) 940.15 ** 15 = 0 950.15 ** -15 = 2283658260521 960.15 ** 1 = 0 970.15 ** -9 = 26012294 980.15 ** 0 = 1 990.15 ** -0 = 1 100 101Number "-0.01" (scale 0) 102-0.01 ** 15 = 0 103-0.01 ** -15 = -1000000000000000000000000000000 104-0.01 ** 1 = 0 105-0.01 ** -9 = -1000000000000000000 106-0.01 ** 0 = 1 107-0.01 ** -0 = 1 108 109Number "15151324141414.412312232141241" (scale 0) 11015151324141414.412312232141241 ** 15 = 509048123991351801905481953476379185972789524506389464560948346272971876778908444213802402540123245924548973078757287880001162665191012187707496396738218203170247236816923480505943223846447785782345 11115151324141414.412312232141241 ** -15 = 0 11215151324141414.412312232141241 ** 1 = 15151324141414 11315151324141414.412312232141241 ** -9 = 0 11415151324141414.412312232141241 ** 0 = 1 11515151324141414.412312232141241 ** -0 = 1 116 117Number "141241241241241248267654747412" (scale 0) 118141241241241241248267654747412 ** 15 = 177591789298838947421924937418435926483207726032941337126565686201154837989992676792469043927153886362407093561688979426718344848540943458245870720268722797084708626211824507010348223033844880992203548347580375252630658556528592298319547225224912135982081686378909626742998484437641863458021277126578238452879997277005795795020835662533892290564198652316605246272512413311084386660488961246461538425989780621930750572963428718487554490368 119141241241241241248267654747412 ** -15 = 0 120141241241241241248267654747412 ** 1 = 141241241241241248267654747412 121141241241241241248267654747412 ** -9 = 0 122141241241241241248267654747412 ** 0 = 1 123141241241241241248267654747412 ** -0 = 1 124 125Number "-149143276547656984948124912" (scale 0) 126-149143276547656984948124912 ** 15 = -401841881822660241398409660309345646463535278187389488718526585893873800090729191609465595568674086078015487989884600849819723618141030735892646637579078630759905628572464757376301450900008605507116286859140901254928168279833198528761329808672095261265618307499605901098109261736293336298350347017449323858811047847238969925531775390894165290898723086447624518554747816961256145036283496890368 127-149143276547656984948124912 ** -15 = 0 128-149143276547656984948124912 ** 1 = -149143276547656984948124912 129-149143276547656984948124912 ** -9 = 0 130-149143276547656984948124912 ** 0 = 1 131-149143276547656984948124912 ** -0 = 1 132 133Number "-132132245132134.1515123765412" (scale 0) 134-132132245132134.1515123765412 ** 15 = -65332942084431118671715132691017936828728297532817376297090067844431557352758338594306899592493441083845683845573112529065975725871957965764869599362286162979915656223771056616561461958797695558519631556073805440 135-132132245132134.1515123765412 ** -15 = 0 136-132132245132134.1515123765412 ** 1 = -132132245132134 137-132132245132134.1515123765412 ** -9 = 0 138-132132245132134.1515123765412 ** 0 = 1 139-132132245132134.1515123765412 ** -0 = 1 140 141Number "0.1322135476547459213732911312" (scale 0) 1420.1322135476547459213732911312 ** 15 = 0 1430.1322135476547459213732911312 ** -15 = 15165635699683 1440.1322135476547459213732911312 ** 1 = 0 1450.1322135476547459213732911312 ** -9 = 81005847 1460.1322135476547459213732911312 ** 0 = 1 1470.1322135476547459213732911312 ** -0 = 1 148 149Number "-0.123912932193769965476541321" (scale 0) 150-0.123912932193769965476541321 ** 15 = 0 151-0.123912932193769965476541321 ** -15 = -40109799462729 152-0.123912932193769965476541321 ** 1 = 0 153-0.123912932193769965476541321 ** -9 = -145194543 154-0.123912932193769965476541321 ** 0 = 1 155-0.123912932193769965476541321 ** -0 = 1 156 157Number "15" (scale 10) 15815 ** 15 = 437893890380859375.0000000000 15915 ** -15 = 0.0000000000 16015 ** 1 = 15.0000000000 16115 ** -9 = 0.0000000000 16215 ** 0 = 1.0000000000 16315 ** -0 = 1.0000000000 164 165Number "-15" (scale 10) 166-15 ** 15 = -437893890380859375.0000000000 167-15 ** -15 = 0.0000000000 168-15 ** 1 = -15.0000000000 169-15 ** -9 = 0.0000000000 170-15 ** 0 = 1.0000000000 171-15 ** -0 = 1.0000000000 172 173Number "1" (scale 10) 1741 ** 15 = 1.0000000000 1751 ** -15 = 1.0000000000 1761 ** 1 = 1.0000000000 1771 ** -9 = 1.0000000000 1781 ** 0 = 1.0000000000 1791 ** -0 = 1.0000000000 180 181Number "-9" (scale 10) 182-9 ** 15 = -205891132094649.0000000000 183-9 ** -15 = 0.0000000000 184-9 ** 1 = -9.0000000000 185-9 ** -9 = -0.0000000025 186-9 ** 0 = 1.0000000000 187-9 ** -0 = 1.0000000000 188 189Number "0" (scale 10) 1900 ** 15 = 0.0000000000 1910 ** -15 = Negative power of zero 1920 ** 1 = 0.0000000000 1930 ** -9 = Negative power of zero 1940 ** 0 = 1.0000000000 1950 ** -0 = 1.0000000000 196 197Number "-0" (scale 10) 198-0 ** 15 = 0.0000000000 199-0 ** -15 = Negative power of zero 200-0 ** 1 = 0.0000000000 201-0 ** -9 = Negative power of zero 202-0 ** 0 = 1.0000000000 203-0 ** -0 = 1.0000000000 204 205Number "14.14" (scale 10) 20614.14 ** 15 = 180609729388653367.2586094856 20714.14 ** -15 = 0.0000000000 20814.14 ** 1 = 14.1400000000 20914.14 ** -9 = 0.0000000000 21014.14 ** 0 = 1.0000000000 21114.14 ** -0 = 1.0000000000 212 213Number "-16.60" (scale 10) 214-16.60 ** 15 = -2002725006700243463.1471178615 215-16.60 ** -15 = 0.0000000000 216-16.60 ** 1 = -16.6000000000 217-16.60 ** -9 = 0.0000000000 218-16.60 ** 0 = 1.0000000000 219-16.60 ** -0 = 1.0000000000 220 221Number "0.15" (scale 10) 2220.15 ** 15 = 0.0000000000 2230.15 ** -15 = 2283658260521.1672220051 2240.15 ** 1 = 0.1500000000 2250.15 ** -9 = 26012294.8737489203 2260.15 ** 0 = 1.0000000000 2270.15 ** -0 = 1.0000000000 228 229Number "-0.01" (scale 10) 230-0.01 ** 15 = 0.0000000000 231-0.01 ** -15 = -1000000000000000000000000000000.0000000000 232-0.01 ** 1 = -0.0100000000 233-0.01 ** -9 = -1000000000000000000.0000000000 234-0.01 ** 0 = 1.0000000000 235-0.01 ** -0 = 1.0000000000 236 237Number "15151324141414.412312232141241" (scale 10) 23815151324141414.412312232141241 ** 15 = 509048123991351801905481953476379185972789524506389464560948346272971876778908444213802402540123245924548973078757287880001162665191012187707496396738218203170247236816923480505943223846447785782345.3558894965 23915151324141414.412312232141241 ** -15 = 0.0000000000 24015151324141414.412312232141241 ** 1 = 15151324141414.4123122321 24115151324141414.412312232141241 ** -9 = 0.0000000000 24215151324141414.412312232141241 ** 0 = 1.0000000000 24315151324141414.412312232141241 ** -0 = 1.0000000000 244 245Number "141241241241241248267654747412" (scale 10) 246141241241241241248267654747412 ** 15 = 177591789298838947421924937418435926483207726032941337126565686201154837989992676792469043927153886362407093561688979426718344848540943458245870720268722797084708626211824507010348223033844880992203548347580375252630658556528592298319547225224912135982081686378909626742998484437641863458021277126578238452879997277005795795020835662533892290564198652316605246272512413311084386660488961246461538425989780621930750572963428718487554490368.0000000000 247141241241241241248267654747412 ** -15 = 0.0000000000 248141241241241241248267654747412 ** 1 = 141241241241241248267654747412.0000000000 249141241241241241248267654747412 ** -9 = 0.0000000000 250141241241241241248267654747412 ** 0 = 1.0000000000 251141241241241241248267654747412 ** -0 = 1.0000000000 252 253Number "-149143276547656984948124912" (scale 10) 254-149143276547656984948124912 ** 15 = -401841881822660241398409660309345646463535278187389488718526585893873800090729191609465595568674086078015487989884600849819723618141030735892646637579078630759905628572464757376301450900008605507116286859140901254928168279833198528761329808672095261265618307499605901098109261736293336298350347017449323858811047847238969925531775390894165290898723086447624518554747816961256145036283496890368.0000000000 255-149143276547656984948124912 ** -15 = 0.0000000000 256-149143276547656984948124912 ** 1 = -149143276547656984948124912.0000000000 257-149143276547656984948124912 ** -9 = 0.0000000000 258-149143276547656984948124912 ** 0 = 1.0000000000 259-149143276547656984948124912 ** -0 = 1.0000000000 260 261Number "-132132245132134.1515123765412" (scale 10) 262-132132245132134.1515123765412 ** 15 = -65332942084431118671715132691017936828728297532817376297090067844431557352758338594306899592493441083845683845573112529065975725871957965764869599362286162979915656223771056616561461958797695558519631556073805440.8743426066 263-132132245132134.1515123765412 ** -15 = 0.0000000000 264-132132245132134.1515123765412 ** 1 = -132132245132134.1515123765 265-132132245132134.1515123765412 ** -9 = 0.0000000000 266-132132245132134.1515123765412 ** 0 = 1.0000000000 267-132132245132134.1515123765412 ** -0 = 1.0000000000 268 269Number "0.1322135476547459213732911312" (scale 10) 2700.1322135476547459213732911312 ** 15 = 0.0000000000 2710.1322135476547459213732911312 ** -15 = 15165635699683.8093525277 2720.1322135476547459213732911312 ** 1 = 0.1322135476 2730.1322135476547459213732911312 ** -9 = 81005847.7955131768 2740.1322135476547459213732911312 ** 0 = 1.0000000000 2750.1322135476547459213732911312 ** -0 = 1.0000000000 276 277Number "-0.123912932193769965476541321" (scale 10) 278-0.123912932193769965476541321 ** 15 = 0.0000000000 279-0.123912932193769965476541321 ** -15 = -40109799462729.8625078080 280-0.123912932193769965476541321 ** 1 = -0.1239129321 281-0.123912932193769965476541321 ** -9 = -145194543.0878622400 282-0.123912932193769965476541321 ** 0 = 1.0000000000 283-0.123912932193769965476541321 ** -0 = 1.0000000000 284