PHP 8.5 updates

This commit is contained in:
Clemens Schwaighofer
2026-01-06 18:37:00 +09:00
parent f765f50350
commit 936b424065
10 changed files with 226 additions and 139 deletions

View File

@@ -62,10 +62,15 @@ class Math
*
* @param float $number Number to cubic root
* @return float Calculated value
* @throws \InvalidArgumentException if $number is negative
*/
public static function cbrt(float|int $number): float
{
return pow((float)$number, 1.0 / 3);
$value = pow((float)$number, 1.0 / 3);
if (is_nan($value)) {
throw new \InvalidArgumentException('cube root from this number is not supported: ' . $number);
}
return $value;
}
/**