|
BcMath\Number::pow任意精度数値をべき乗する 説明
public BcMath\Number BcMath\Number::pow(BcMath\Numberstringint
$exponent, intnull $scale = null)
$this の
パラメータ
戻り値べき乗の結果を新しい BcMath\Number オブジェクトとして返します。
べき乗結果オブジェクトの BcMath\Number::scale が自動的に設定される場合、
負の エラー / 例外このメソッドは、以下の場合に ValueError をスローします:
このメソッドは、$this の値が 例例1 BcMath\Number::pow で 上の例の出力は以下となります。
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)
}
例2 BcMath\Number::pow で 上の例の出力は以下となります。
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)
}
参考
|