@@ -403,7 +403,7 @@ public function pow(Decimal $b, $scale = null)
403
403
} else {
404
404
return NaN::getNaN ();
405
405
}
406
- } elseif ($ b ->isZero ()) {
406
+ } elseif ($ b ->isZero ()) {
407
407
return Decimal::fromInteger (1 , $ scale );
408
408
} elseif ($ b ->scale == 0 ) {
409
409
$ pow_scale = $ scale === null ?
@@ -422,7 +422,12 @@ public function pow(Decimal $b, $scale = null)
422
422
$ remaining_b = bcsub ($ b ->value , $ truncated_b , $ b ->scale );
423
423
424
424
$ first_pow_approx = bcpow ($ this ->value , $ truncated_b , $ pow_scale +1 );
425
- $ intermediate_root = self ::innerPowWithLittleExponent ($ this ->value , $ remaining_b , $ b ->scale , $ pow_scale +1 );
425
+ $ intermediate_root = self ::innerPowWithLittleExponent (
426
+ $ this ->value ,
427
+ $ remaining_b ,
428
+ $ b ->scale ,
429
+ $ pow_scale +1
430
+ );
426
431
427
432
return Decimal::fromString (
428
433
bcmul ($ first_pow_approx , $ intermediate_root , $ pow_scale +1 ),
@@ -717,7 +722,11 @@ private static function innerPowWithLittleExponent ($base, $exponent, $exp_scale
717
722
$ result_b = $ result_a ;
718
723
$ index_info = self ::computeSquareIndex ($ exponent_remaining , $ actual_index , $ exp_scale , $ inner_scale );
719
724
$ exponent_remaining = $ index_info [1 ];
720
- $ result_a = bcmul ($ result_a , self ::compute2NRoot ($ base , $ index_info [0 ], 2 *($ out_scale +1 )), 2 *($ out_scale +1 ));
725
+ $ result_a = bcmul (
726
+ $ result_a ,
727
+ self ::compute2NRoot ($ base , $ index_info [0 ], 2 *($ out_scale +1 )),
728
+ 2 *($ out_scale +1 )
729
+ );
721
730
}
722
731
723
732
return self ::innerRound ($ result_a , $ out_scale );
0 commit comments