downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

gmp_powm> <gmp_popcount
[edit] Last updated: Fri, 17 May 2013

view this page in

gmp_pow

(PHP 4 >= 4.0.4, PHP 5)

gmp_powべき乗を計算する

説明

resource gmp_pow ( resource $base , int $exp )

baseexp 乗を計算します。

パラメータ

base

もととなる数。

GMP 数リソース、 あるいは数値に変換可能な数値形式の文字列。

exp

正の数で、base を何乗するかを指定します。

返り値

べき乗の結果を GMP 数で返します。 0^0 は 1 となります。

例1 gmp_pow() の例

<?php
$pow1 
gmp_pow("2"31);
echo 
gmp_strval($pow1) . "\n";
$pow2 gmp_pow("0"0);
echo 
gmp_strval($pow2) . "\n";
$pow3 gmp_pow("2", -1); // 負のべき乗を指定したため、警告を発生します
echo gmp_strval($pow3) . "\n";
?>

上の例の出力は以下となります。

2147483648
1



add a note add a note User Contributed Notes gmp_pow - [1 notes]
up
0
rahulkadukar at yahoo dot com
2 years ago
A Sample code can be shown as

<?php
echo gmp_strval(gmp_pow(4,4)); //This would give the answer as 256
?>

 
show source | credits | stats | sitemap | contact | advertising | mirror sites