diff --git a/language-snippets.ent b/language-snippets.ent index 599e2ec9fc2a..bc2c4d5ec6e5 100644 --- a/language-snippets.ent +++ b/language-snippets.ent @@ -2149,11 +2149,17 @@ extensions in order to use these functions.'> SQL safe mode'> - -scaleThis optional parameter is used to set the number -of digits after the decimal place in the result. If omitted, it will default to the scale set -globally with the bcscale function, or fallback to 0 if -this has not been set.'> + + scale + + + This parameter is used to set the number of digits after the decimal place in the result. + If &null;, it will default to the default scale set with bcscale, + or fallback to the value of the + bcmath.scale INI directive. + + +'> diff --git a/reference/bc/functions/bcadd.xml b/reference/bc/functions/bcadd.xml index bf94baeb4630..5b5a475de04a 100644 --- a/reference/bc/functions/bcadd.xml +++ b/reference/bc/functions/bcadd.xml @@ -51,7 +51,23 @@ The sum of the two operands, as a string. - + + + &reftitle.errors; + + This function throws a ValueError in the following cases: + + + num1 or num2 + is not a well-formed BCMath numeric string. + + + scale is outside the valid range. + + + + + &reftitle.changelog; diff --git a/reference/bc/functions/bcceil.xml b/reference/bc/functions/bcceil.xml index d2e9be85e986..1f326182733d 100644 --- a/reference/bc/functions/bcceil.xml +++ b/reference/bc/functions/bcceil.xml @@ -39,6 +39,14 @@ + + &reftitle.errors; + + This function throws a ValueError if + num is not a well-formed BCMath numeric string. + + + &reftitle.examples; diff --git a/reference/bc/functions/bccomp.xml b/reference/bc/functions/bccomp.xml index 052c5d4f6718..437effb2a9fe 100644 --- a/reference/bc/functions/bccomp.xml +++ b/reference/bc/functions/bccomp.xml @@ -1,6 +1,6 @@ - + bccomp Compare two arbitrary precision numbers @@ -15,55 +15,26 @@ intnullscale&null; - Compares the num1 to the - num2 and returns the result as an - integer. + Compares num1 to num2 + and returns the result of the comparison as an integer. - &reftitle.parameters; - - - - num1 - - - The left operand, as a string. - - - - - num2 - - - The right operand, as a string. - - - - - scale - - - The optional scale parameter is used to set the - number of digits after the decimal place which will be used in the - comparison. - - - - - + &reftitle.returnvalues; - - Returns 0 if the two operands are equal, 1 if the - num1 is larger than the - num2, -1 otherwise. - + + Returns 0 if both operands are equal, + 1 if num1 is greater than + num2, -1 otherwise. + - + + + &reftitle.changelog; diff --git a/reference/bc/functions/bcdiv.xml b/reference/bc/functions/bcdiv.xml index 0abfdbe95e99..bd293ebd4cee 100644 --- a/reference/bc/functions/bcdiv.xml +++ b/reference/bc/functions/bcdiv.xml @@ -1,6 +1,6 @@ - + bcdiv Divide two arbitrary precision numbers @@ -14,10 +14,9 @@ stringnum2 intnullscale&null; - - Divides the num1 by the - num2. - + + Divides num1 by num2. + @@ -53,17 +52,11 @@ - &reftitle.errors; - - This function throws a ValueError in the following cases: - - num1 or num2 is not a well-formed BCMath numeric string - scale is outside the valid range - - + + - This function throws a DivisionByZeroError exception if num2 - is 0. + This function throws a DivisionByZeroError + exception if num2 is 0. @@ -87,7 +80,9 @@ 8.0.0 - Dividing by 0 now throws a DivisionByZeroError exception instead of returning null. + Dividing by 0 now throws a + DivisionByZeroError exception + instead of returning &null;. diff --git a/reference/bc/functions/bcdivmod.xml b/reference/bc/functions/bcdivmod.xml index 76cd7c2b7684..e079ff7a950a 100644 --- a/reference/bc/functions/bcdivmod.xml +++ b/reference/bc/functions/bcdivmod.xml @@ -1,6 +1,6 @@ - + bcdivmod Get the quotient and modulus of an arbitrary precision number @@ -21,26 +21,7 @@ - &reftitle.parameters; - - - num1 - - - The dividend, as a string. - - - - - num2 - - - The divisor, as a string. - - - - &bc.scale.description; - + @@ -51,20 +32,7 @@ - - &reftitle.errors; - - This function throws a ValueError in the following cases: - - num1 or num2 is not a well-formed BCMath numeric string - scale is outside the valid range - - - - This function throws a DivisionByZeroError exception if num2 - is 0. - - + &reftitle.examples; diff --git a/reference/bc/functions/bcfloor.xml b/reference/bc/functions/bcfloor.xml index 8ed28a46e60b..61b8c73410de 100644 --- a/reference/bc/functions/bcfloor.xml +++ b/reference/bc/functions/bcfloor.xml @@ -1,6 +1,6 @@ - + bcfloor Round down arbitrary precision number @@ -19,17 +19,7 @@ - &reftitle.parameters; - - - num - - - The value to round. - - - - + @@ -39,6 +29,8 @@ + + &reftitle.examples; diff --git a/reference/bc/functions/bcmod.xml b/reference/bc/functions/bcmod.xml index 2f5135d1772f..3bad43f5c793 100644 --- a/reference/bc/functions/bcmod.xml +++ b/reference/bc/functions/bcmod.xml @@ -1,6 +1,6 @@ - + bcmod Get modulus of an arbitrary precision number @@ -17,34 +17,12 @@ Get the remainder of dividing num1 by num2. - Unless num2 is zero, the result has the same sign - as num1. + The result has the same sign as num1. - &reftitle.parameters; - - - - num1 - - - The dividend, as a string. - - - - - num2 - - - The divisor, as a string. - - - - &bc.scale.description; - - + @@ -54,20 +32,7 @@ - - &reftitle.errors; - - This function throws a ValueError in the following cases: - - num1 or num2 is not a well-formed BCMath numeric string - scale is outside the valid range - - - - This function throws a DivisionByZeroError exception if num2 - is 0. - - + &reftitle.changelog; @@ -89,7 +54,7 @@ 8.0.0 - Dividing by 0 now throws a DivisionByZeroError exception instead of returning null. + Dividing by 0 now throws a DivisionByZeroError exception instead of returning null. diff --git a/reference/bc/functions/bcmul.xml b/reference/bc/functions/bcmul.xml index d45351230b49..1557d195e39a 100644 --- a/reference/bc/functions/bcmul.xml +++ b/reference/bc/functions/bcmul.xml @@ -1,6 +1,6 @@ - + bcmul Multiply two arbitrary precision numbers @@ -14,35 +14,13 @@ stringnum2 intnullscale&null; - - Multiply the num1 by the - num2. - + + Multiply num1 by num2. + - &reftitle.parameters; - - - - num1 - - - The left operand, as a string. - - - - - num2 - - - The right operand, as a string. - - - - &bc.scale.description; - - + @@ -51,7 +29,9 @@ Returns the result as a string. - + + + &reftitle.changelog; @@ -100,7 +80,7 @@ echo bcmul('2', '4'); // 8 &reftitle.notes; - Before PHP 7.3.0 bcmul may return a result with fewer digits after the + Prior to PHP 7.3.0, bcmul may return a result with fewer digits after the decimal point than the scale parameter would indicate. This only occurs when the result doesn't require all of the precision allowed by the scale. For example: diff --git a/reference/bc/functions/bcpow.xml b/reference/bc/functions/bcpow.xml index ca3d701cee44..71ec11020ba6 100644 --- a/reference/bc/functions/bcpow.xml +++ b/reference/bc/functions/bcpow.xml @@ -60,8 +60,8 @@ This function throws a ValueError in the following cases: num or exponent is not a well-formed BCMath numeric string - scale is outside the valid range exponent has a fractional part + exponent or scale is outside the valid range @@ -84,7 +84,7 @@ 8.4.0 - Negative powers of 0 previously returned 0, but now throw a DivisionByZeroError + Negative powers of 0 previously returned 0, but now throw a DivisionByZeroError exception. diff --git a/reference/bc/functions/bcpowmod.xml b/reference/bc/functions/bcpowmod.xml index 0d173eb0fdff..24690801bf50 100644 --- a/reference/bc/functions/bcpowmod.xml +++ b/reference/bc/functions/bcpowmod.xml @@ -59,11 +59,27 @@ &reftitle.returnvalues; - Returns the result as a string, or &false; if modulus - is 0 or exponent is negative. + Returns the result as a string. + + &reftitle.errors; + + This function throws a ValueError in the following cases: + + num, exponent or modulus is not a well-formed BCMath numeric string + num, exponent or modulus has a fractional part + exponent is a negative value + scale is outside the valid range + + + + This function throws a DivisionByZeroError exception if modulus + is 0. + + + &reftitle.changelog; @@ -81,6 +97,18 @@ scale is now nullable. + + 8.0.0 + + Now throws a ValueError instead of returning &false; if exponent is a negative value. + + + + 8.0.0 + + Dividing by 0 now throws a DivisionByZeroError exception instead of returning &false;. + + diff --git a/reference/bc/functions/bcround.xml b/reference/bc/functions/bcround.xml index a5ffa6acaa3e..3b5e4de88c1a 100644 --- a/reference/bc/functions/bcround.xml +++ b/reference/bc/functions/bcround.xml @@ -45,6 +45,17 @@ + + &reftitle.errors; + + This function throws a ValueError in the following cases: + + num is not a well-formed BCMath numeric string. + scale is outside the valid range. + + + + &reftitle.examples; diff --git a/reference/bc/functions/bcscale.xml b/reference/bc/functions/bcscale.xml index 62eb2580020f..051c14c2ce82 100644 --- a/reference/bc/functions/bcscale.xml +++ b/reference/bc/functions/bcscale.xml @@ -47,7 +47,15 @@ Returns the old scale when used as setter. Otherwise the current scale is returned. - + + + &reftitle.errors; + + This function throws a ValueError if scale + is outside the valid range. + + + &reftitle.changelog; diff --git a/reference/bc/functions/bcsqrt.xml b/reference/bc/functions/bcsqrt.xml index 4da28a897f1d..1564638a58b9 100644 --- a/reference/bc/functions/bcsqrt.xml +++ b/reference/bc/functions/bcsqrt.xml @@ -13,9 +13,9 @@ stringnum intnullscale&null; - - Return the square root of the num. - + + Return the square root of num. + diff --git a/reference/bc/functions/bcsub.xml b/reference/bc/functions/bcsub.xml index ecc777421020..adb4c1b8972c 100644 --- a/reference/bc/functions/bcsub.xml +++ b/reference/bc/functions/bcsub.xml @@ -1,6 +1,6 @@ - + bcsub Subtract one arbitrary precision number from another @@ -14,35 +14,13 @@ stringnum2 intnullscale&null; - - Subtracts the num2 from the - num1. - + + Subtracts num2 from num1. + - &reftitle.parameters; - - - - num1 - - - The left operand, as a string. - - - - - num2 - - - The right operand, as a string. - - - - &bc.scale.description; - - + @@ -51,7 +29,9 @@ The result of the subtraction, as a string. - + + + &reftitle.changelog;