xref: /PHP-8.3/ext/bcmath/tests/bcsqrt.phpt (revision ee226128)
1--TEST--
2bcsqrt() function
3--EXTENSIONS--
4bcmath
5--INI--
6bcmath.scale=0
7--FILE--
8<?php
9
10$radicants = [
11    "0",
12    "0.00",
13    "-0",
14    "-0.00",
15    "15151324141414.412312232141241",
16    "141241241241241248267654747412",
17    "0.1322135476547459213732911312",
18    "14.14",
19    "0.15",
20    "15",
21    "1",
22];
23$scales = [0, 10];
24
25foreach ($scales as $scale) {
26    foreach ($radicants as $radicant) {
27        echo bcsqrt($radicant, $scale), "\n";
28    }
29}
30
31?>
32--EXPECT--
330
340
350
360
373892470
38375820756799356
390
403
410
423
431
440.0000000000
450.0000000000
460.0000000000
470.0000000000
483892470.1850385973
49375820756799356.7439216735
500.3636118090
513.7603191353
520.3872983346
533.8729833462
541.0000000000
55