reference/bc/functions/bcsqrt.xml
04c37bc8ca6b2faff2b14b85b4576529444bd6a2
...
...
@@ -10,11 +10,11 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>string</type><methodname>bcsqrt</methodname>
13
-
<methodparam><type>string</type><parameter>operand</parameter></methodparam>
14
-
<methodparam choice="opt"><type>int</type><parameter>scale</parameter><initializer>0</initializer></methodparam>
13
+
<methodparam><type>string</type><parameter>num</parameter></methodparam>
14
+
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>scale</parameter><initializer>&null;</initializer></methodparam>
15
15
</methodsynopsis>
16
16
<para>
17
-
Return the square root of the <parameter>operand</parameter>.
17
+
Return the square root of the <parameter>num</parameter>.
18
18
</para>
19
19
</refsect1>
20
20

...
...
@@ -23,10 +23,10 @@
23
23
<para>
24
24
<variablelist>
25
25
<varlistentry>
26
-
<term><parameter>operand</parameter></term>
26
+
<term><parameter>num</parameter></term>
27
27
<listitem>
28
28
<para>
29
-
The operand, as a string.
29
+
The operand, as a well-formed BCMath numeric string.
30
30
</para>
31
31
</listitem>
32
32
</varlistentry>
...
...
@@ -38,11 +38,60 @@
38
38
<refsect1 role="returnvalues">
39
39
&reftitle.returnvalues;
40
40
<para>
41
-
Returns the square root as a string, or &null; if
42
-
<parameter>operand</parameter> is negative.
41
+
Returns the square root as a well-formed BCMath numeric string.
43
42
</para>
44
43
</refsect1>
45
44
45
+
<refsect1 role="errors">
46
+
&reftitle.errors;
47
+
<para>
48
+
This function throws a <classname>ValueError</classname> in the following cases:
49
+
<simplelist>
50
+
<member><parameter>num</parameter> is not a well-formed BCMath numeric string</member>
51
+
<member><parameter>num</parameter> is less than <literal>0</literal></member>
52
+
<member><parameter>scale</parameter> is outside the valid range</member>
53
+
</simplelist>
54
+
</para>
55
+
</refsect1>
56
+

57
+
<refsect1 role="changelog">
58
+
&reftitle.changelog;
59
+
<informaltable>
60
+
<tgroup cols="2">
61
+
<thead>
62
+
<row>
63
+
<entry>&Version;</entry>
64
+
<entry>&Description;</entry>
65
+
</row>
66
+
</thead>
67
+
<tbody>
68
+
<row>
69
+
<entry>8.0.0</entry>
70
+
<entry>
71
+
If <parameter>num</parameter> is not a well-formed BCMath numeric string,
72
+
or less than <literal>0</literal>, a <classname>ValueError</classname> is thrown.
73
+
Previously, <constant>E_WARNING</constant> was raised instead.
74
+
</entry>
75
+
</row>
76
+
<row>
77
+
<entry>8.0.0</entry>
78
+
<entry>
79
+
<parameter>scale</parameter> now needs to be between <literal>0</literal>
80
+
and <literal>2147483647</literal>; previously, negative scales have been
81
+
silently treated as <literal>0</literal>.
82
+
</entry>
83
+
</row>
84
+
<row>
85
+
<entry>8.0.0</entry>
86
+
<entry>
87
+
<parameter>scale</parameter> is now nullable.
88
+
</entry>
89
+
</row>
90
+
</tbody>
91
+
</tgroup>
92
+
</informaltable>
93
+
</refsect1>
94
+

46
95
<refsect1 role="examples">
47
96
&reftitle.examples;
48
97
<example>
...
...
@@ -68,7 +117,6 @@ echo bcsqrt('2', 3); // 1.414
68
117
</para>
69
118
</refsect1>
70
119
</refentry>
71
-

72
120
<!-- Keep this comment at the end of the file
73
121
Local variables:
74
122
mode: sgml
75
123