From d0aea108914e426113010607dbf631a8a0da0f86 Mon Sep 17 00:00:00 2001 From: Saki Takamachi Date: Wed, 27 Nov 2024 14:39:26 +0900 Subject: [PATCH] Fixed and added exception behavior. Also added a literal tag --- reference/bc/functions/bcadd.xml | 13 +++++++++++- reference/bc/functions/bcceil.xml | 11 ++++++++++ reference/bc/functions/bccomp.xml | 17 ++++++++++++--- reference/bc/functions/bcdiv.xml | 2 +- reference/bc/functions/bcfloor.xml | 11 ++++++++++ reference/bc/functions/bcmod.xml | 2 +- reference/bc/functions/bcmul.xml | 13 +++++++++++- reference/bc/functions/bcpow.xml | 2 +- reference/bc/functions/bcpowmod.xml | 32 +++++++++++++++++++++++++++-- reference/bc/functions/bcround.xml | 11 ++++++++++ reference/bc/functions/bcscale.xml | 10 ++++++++- reference/bc/functions/bcsub.xml | 13 +++++++++++- 12 files changed, 125 insertions(+), 12 deletions(-) diff --git a/reference/bc/functions/bcadd.xml b/reference/bc/functions/bcadd.xml index bf94baeb4630..d5f4626a6f92 100644 --- a/reference/bc/functions/bcadd.xml +++ b/reference/bc/functions/bcadd.xml @@ -51,7 +51,18 @@ 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..ae3bb052bcde 100644 --- a/reference/bc/functions/bcceil.xml +++ b/reference/bc/functions/bcceil.xml @@ -39,6 +39,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/bccomp.xml b/reference/bc/functions/bccomp.xml index 052c5d4f6718..cc9803a9253d 100644 --- a/reference/bc/functions/bccomp.xml +++ b/reference/bc/functions/bccomp.xml @@ -58,12 +58,23 @@ &reftitle.returnvalues; - Returns 0 if the two operands are equal, 1 if the + Returns 0 if the two operands are equal, 1 if the num1 is larger than the - num2, -1 otherwise. + num2, -1 otherwise. - + + + &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/bcdiv.xml b/reference/bc/functions/bcdiv.xml index 0abfdbe95e99..ca99467b847b 100644 --- a/reference/bc/functions/bcdiv.xml +++ b/reference/bc/functions/bcdiv.xml @@ -87,7 +87,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/bcfloor.xml b/reference/bc/functions/bcfloor.xml index 8ed28a46e60b..49675d2ec186 100644 --- a/reference/bc/functions/bcfloor.xml +++ b/reference/bc/functions/bcfloor.xml @@ -39,6 +39,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/bcmod.xml b/reference/bc/functions/bcmod.xml index 2f5135d1772f..06a03bccb23c 100644 --- a/reference/bc/functions/bcmod.xml +++ b/reference/bc/functions/bcmod.xml @@ -89,7 +89,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..f9b5134f6f13 100644 --- a/reference/bc/functions/bcmul.xml +++ b/reference/bc/functions/bcmul.xml @@ -51,7 +51,18 @@ Returns the result 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/bcpow.xml b/reference/bc/functions/bcpow.xml index ca3d701cee44..a0cdc1d6a206 100644 --- a/reference/bc/functions/bcpow.xml +++ b/reference/bc/functions/bcpow.xml @@ -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..bae3a7c95eec 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 + scale is outside the valid range + exponent is a negative value + + + + 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..6959751f9572 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/bcsub.xml b/reference/bc/functions/bcsub.xml index ecc777421020..e3c0baa0decf 100644 --- a/reference/bc/functions/bcsub.xml +++ b/reference/bc/functions/bcsub.xml @@ -51,7 +51,18 @@ The result of the subtraction, 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;