exp

(PHP 4, PHP 5, PHP 7, PHP 8)

expe の累乗を計算する

説明

exp(float $num): float

enum 乗した値を返します。

注意:

'e' は自然対数の底で、およそ 2.718282 です。

パラメータ

num

処理する引数。

戻り値

'e' の num 乗を返します。

例1 exp() の例

<?php
echo exp(12) . "\n";
echo
exp(5.7);
?>

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

1.6275E+005
298.87

参考

add a note

User Contributed Notes 1 note

up
3
zooly at globmi dot com
14 years ago
PHP does not have the following math function in any extensions:frexp() - Extract Mantissa and Exponent of the Floating-Point ValueI've digged many C source codes, and found the simplest implementation as follows:<?phpfunction frexp ( $float ) {  $exponent = ( floor(log($float, 2)) + 1 );  $mantissa = ( $float * pow(2, -$exponent) );  return(    array($mantissa, $exponent)  );}print_r(frexp(0.0345));print_r(frexp(21.539));?>Array(    [0] => 0.552    [1] => -4)Array(    [0] => 0.67309375    [1] => 5)I have compared the results using a lot of floats against C's frexp function - they are the same.Note that C and PHP uses different float precisions, for example "4619.3" gives:C: 0.56387939453125, 13PHP: 0.563879394531, 13/Assuming default configurations./
To Top