Skip to content

ext/bcmath: Performance improvement bcsqrt() #18771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Added test cases
  • Loading branch information
SakiTakamachi committed Jun 11, 2025
commit d7d1d803439873cb10fb1584a5d6896a2777b0ca
21 changes: 21 additions & 0 deletions ext/bcmath/tests/bcsqrt.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ foreach ($scales as $scale) {
}
}

echo "\n";

$radicants = [
"0.005432987654321",
"0.0005432987654321",
"0.0000000000005432987654321",
"0.00000000000005432987654321",
"0.00000000000098765432109876543210987654321098765432109876543210987654321",
"0.000000000000098765432109876543210987654321098765432109876543210987654321",
];
foreach ($radicants as $radicant) {
echo bcsqrt($radicant, 20), "\n";
}

?>
--EXPECT--
0
Expand All @@ -52,3 +66,10 @@ foreach ($scales as $scale) {
0.3872983346
3.8729833462
1.0000000000

0.07370880309922960619
0.02330877013984435859
0.00000073708803099229
0.00000023308770139844
0.00000099380799005580
0.00000031426968054503