TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
587 B
33 lines
587 B
--TEST--
|
|
Big* types: math function optimization (abs/pow/sqrt/floor/ceil/round)
|
|
--FILE--
|
|
<?php
|
|
declare(strict_types=1);
|
|
use native_types;
|
|
|
|
function main(): void {
|
|
// BigInt
|
|
$a = std::bigInt("100");
|
|
$a1 = abs($a);
|
|
$a2 = pow($a, 2);
|
|
$a3 = sqrt($a);
|
|
|
|
// Decimal
|
|
$b = std::decimal("3.14");
|
|
$b1 = abs($b);
|
|
$b2 = pow($b, 3);
|
|
$b3 = sqrt($b);
|
|
$b4 = floor($b);
|
|
$b5 = ceil($b);
|
|
$b6 = round($b);
|
|
$b7 = round(std::decimal("3.14159"), 2);
|
|
|
|
// BigFloat
|
|
$c = std::bigFloat("-2.5");
|
|
$c1 = abs($c);
|
|
|
|
echo "OK\n";
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
OK
|
|
|