PHP.nl

bcpow

bcpow

Raise an arbitrary precision number to another

string **bcpow** string $num string $exponent  $scale

Raise to the power . num``exponent

numThe base, as a string.

exponent The exponent, as a string. Must be a value with no fractional part. The valid range of the exponent is platform specific, but is at least to . -2147483648``2147483647

Returns the result as a string.

This function throws a in the following cases:

num``exponent``exponent``exponent``scale

This function throws a exception if is and is a negative value. num``0``exponent

Voorbeeld: example

<?php

echo bcpow('4.2', '3', 2); // 74.08

?>

Opmerking: > Before PHP 7.3.0 may return a result with fewer digits after the decimal point than the parameter would indicate. This only occurs when the result doesn't require all of the precision allowed by the . For example:

bcpow``scale``scaleVoorbeeld: scale example

<?php
echo bcpow('5', '2', 2);     // prints "25", not "25.00"
?>

bcpowmod``bcsqrt``BcMath\Number::pow