PHP/Math/Math Functions
Содержание
Difference between ceil and floor
<source lang="html4strict">
<? $my_double = 4.7; $my_int = ceil($my_double); echo($my_int);
$my_double = -4.7; $my_int = floor($my_double); echo($my_int);
?>
</source>
Exp
<source lang="html4strict">
<?
$test_449 = 449.0;
$test_449 = pow(10, exp(log(log10($test_449))));
print("test_449 is $test_449
");
?>
</source>
Floor in action
<source lang="html4strict">
<? $my_int = floor(4.7); echo($my_int);
$my_int = floor(-4.7); echo($my_int);
?>
</source>
Get the Power
<source lang="html4strict">
<? echo pow(19, 5); ?>
</source>
rand demo
<source lang="html4strict">
<? echo rand(0,576); ?>
</source>
Round in action
<source lang="html4strict">
<? $my_int = round(4.7); echo($my_int); $my_int = round(-4.7); echo($my_int); $my_int = round(-4.5); echo($my_int); ?>
</source>
Using the arbitrary-precision functions for exact integer arithmetic
<source lang="html4strict">
<? for ($x = 1; $x < 25; $x++) {
print("$x to the $x power is " . bcpow($x, $x) . "
");
} ?>
</source>