private static function innerPowWithLittleExponent($base, $exponent, $exp_scale, $out_scale)
{
$inner_scale = ceil($exp_scale * log(10) / log(2)) + 1;
$result_a = '1';
$result_b = '0';
$actual_index = 0;
$exponent_remaining = $exponent;
while (bccomp($result_a, $result_b, $out_scale) !== 0 && bccomp($exponent_remaining, '0', $inner_scale) !== 0) {
$result_b = $result_a;
$index_info = self::computeSquareIndex($exponent_remaining, $actual_index, $exp_scale, $inner_scale);
$exponent_remaining = $index_info[1];
$result_a = bcmul($result_a, self::compute2NRoot($base, $index_info[0], 2 * ($out_scale + 1)), 2 * ($out_scale + 1));
}
return self::innerRound($result_a, $out_scale);
}