|
BcMath\Number::powRaises an arbitrary precision number Description
public BcMath\Number BcMath\Number::pow(BcMath\Numberstringint
$exponent, intnull $scale = null)
Raises $this to the Parameters
Return ValuesReturns the result of power as a new BcMath\Number object.
When the BcMath\Number::scale of the result object is automatically set,
depending on the value of
If an indivisible division occurs due to a negative Errors/ExceptionsThis method throws a ValueError in the following cases:
This method throws a DivisionByZeroError exception if $this's value
is ExamplesExample #1 BcMath\Number::pow example when The above example will output:
object(BcMath\Number)#1 (2) {
["value"]=>
string(3) "3.0"
["scale"]=>
int(1)
}
object(BcMath\Number)#3 (2) {
["value"]=>
string(9) "243.00000"
["scale"]=>
int(5)
}
object(BcMath\Number)#2 (2) {
["value"]=>
string(13) "0.33333333333"
["scale"]=>
int(11)
}
object(BcMath\Number)#4 (2) {
["value"]=>
string(1) "1"
["scale"]=>
int(0)
}
Example #2 BcMath\Number::pow example of explicitly specifying The above example will output:
object(BcMath\Number)#1 (2) {
["value"]=>
string(3) "3.0"
["scale"]=>
int(1)
}
object(BcMath\Number)#3 (2) {
["value"]=>
string(3) "243"
["scale"]=>
int(0)
}
object(BcMath\Number)#2 (2) {
["value"]=>
string(4) "0.33"
["scale"]=>
int(2)
}
object(BcMath\Number)#4 (2) {
["value"]=>
string(12) "1.0000000000"
["scale"]=>
int(10)
}
See Also
|