diff -Naur a/BCMath.php b/BCMath.php --- a/BCMath.php 2024-02-21 11:30:36.000000000 +0100 +++ b/BCMath.php 2024-06-01 23:15:29.580565608 +0200 @@ -363,12 +363,13 @@ 'sqrt' => 2, 'sub' => 3 ]; - if (count($arguments) < $params[$name] - 1) { + $cnt = count($arguments); + if ($cnt < $params[$name] - 1) { $min = $params[$name] - 1; - throw new \ArgumentCountError("bc$name() expects at least $min parameters, " . func_num_args() . " given"); + throw new \ArgumentCountError("bc$name() expects at least $min parameters, " . $cnt . " given"); } - if (count($arguments) > $params[$name]) { - $str = "bc$name() expects at most {$params[$name]} parameters, " . func_num_args() . " given"; + if ($cnt > $params[$name]) { + $str = "bc$name() expects at most {$params[$name]} parameters, " . $cnt . " given"; throw new \ArgumentCountError($str); } $numbers = array_slice($arguments, 0, $params[$name] - 1);