From eb383a2228e53d4f2c5e608eb75873d1af61d85d Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Mon, 11 Nov 2024 03:39:43 +0000 Subject: [PATCH 1/4] PHP-8.4: Document fpow() --- reference/math/functions/fdiv.xml | 4 +- reference/math/functions/fpow.xml | 108 ++++++++++++++++++++++++++++++ reference/math/functions/pow.xml | 1 + reference/math/versions.xml | 1 + 4 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 reference/math/functions/fpow.xml diff --git a/reference/math/functions/fdiv.xml b/reference/math/functions/fdiv.xml index c75b2e1487d1..f05efef8f086 100644 --- a/reference/math/functions/fdiv.xml +++ b/reference/math/functions/fdiv.xml @@ -76,9 +76,9 @@ var_dump(fdiv(0.0, 0.0)); // float(NAN) &reftitle.seealso; - / - Floating-point division intdiv - Integer division - fmod - Modulus + fmod + fpow diff --git a/reference/math/functions/fpow.xml b/reference/math/functions/fpow.xml new file mode 100644 index 000000000000..9e3335397260 --- /dev/null +++ b/reference/math/functions/fpow.xml @@ -0,0 +1,108 @@ + + + + fpow + Raise one number to the power of another, according to IEEE 754 + + + + &reftitle.description; + + floatfpow + floatnum + floatexponent + + + Returns the floating point result of raising + num1 to the power of exponent. + If num1 is zero and exponent + is less than zero, then INF is returned. + + + + + &reftitle.parameters; + + + num + + + The base to number. + + + + + exponent + + + The exponent. + + + + + + + + &reftitle.returnvalues; + + Returns a float corresponding to + num$exponent. + + + + + &reftitle.examples; + + <function>fpow</function> example + + +]]> + + &example.outputs; + + + + + + + + &reftitle.seealso; + + / - Floating-point division + pow + fdiv + fmod + + + + + + diff --git a/reference/math/functions/pow.xml b/reference/math/functions/pow.xml index e32338103b4e..7788e11c247f 100644 --- a/reference/math/functions/pow.xml +++ b/reference/math/functions/pow.xml @@ -95,6 +95,7 @@ echo pow(-1, 5.5); // NAN &reftitle.seealso; + fpow exp sqrt bcpow diff --git a/reference/math/versions.xml b/reference/math/versions.xml index 0429d661a3aa..f3688e13677d 100644 --- a/reference/math/versions.xml +++ b/reference/math/versions.xml @@ -26,6 +26,7 @@ + From 1eff2bba9b85762df1a59c01822fa77724e3bd24 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Tue, 12 Nov 2024 14:12:00 +0000 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: Christoph M. Becker --- reference/math/functions/fpow.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reference/math/functions/fpow.xml b/reference/math/functions/fpow.xml index 9e3335397260..8341d120e9d2 100644 --- a/reference/math/functions/fpow.xml +++ b/reference/math/functions/fpow.xml @@ -14,8 +14,8 @@ Returns the floating point result of raising - num1 to the power of exponent. - If num1 is zero and exponent + num to the power of exponent. + If num is zero and exponent is less than zero, then INF is returned. @@ -46,7 +46,7 @@ &reftitle.returnvalues; Returns a float corresponding to - num$exponent. + $num$exponent. From 040a14da4d974ef1269fb29a4273ca5a8b4006a9 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Tue, 12 Nov 2024 14:11:38 +0000 Subject: [PATCH 3/4] Fix sentence --- reference/math/functions/fpow.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/math/functions/fpow.xml b/reference/math/functions/fpow.xml index 8341d120e9d2..012aaa22184f 100644 --- a/reference/math/functions/fpow.xml +++ b/reference/math/functions/fpow.xml @@ -27,7 +27,7 @@ num - The base to number. + The base to use. From 2da7bf05d90043672e2847c399b45d11da5a0505 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Tue, 12 Nov 2024 14:16:34 +0000 Subject: [PATCH 4/4] Address review comments --- reference/math/functions/fdiv.xml | 4 ++++ reference/math/functions/fpow.xml | 10 ++++++---- reference/math/functions/pow.xml | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/reference/math/functions/fdiv.xml b/reference/math/functions/fdiv.xml index f05efef8f086..95457f616bc7 100644 --- a/reference/math/functions/fdiv.xml +++ b/reference/math/functions/fdiv.xml @@ -76,6 +76,10 @@ var_dump(fdiv(0.0, 0.0)); // float(NAN) &reftitle.seealso; + + Division operator + / + intdiv - Integer division fmod fpow diff --git a/reference/math/functions/fpow.xml b/reference/math/functions/fpow.xml index 012aaa22184f..dc8a2d264fb1 100644 --- a/reference/math/functions/fpow.xml +++ b/reference/math/functions/fpow.xml @@ -57,6 +57,7 @@ @@ -65,6 +66,7 @@ var_dump(fpow(-1, 5.5)); &example.outputs; @@ -75,13 +77,13 @@ float(NAN) &reftitle.seealso; - / - Floating-point division + + Exponentiation operator + ** + pow fdiv fmod - diff --git a/reference/math/functions/pow.xml b/reference/math/functions/pow.xml index 7788e11c247f..fd6f17147dd4 100644 --- a/reference/math/functions/pow.xml +++ b/reference/math/functions/pow.xml @@ -95,6 +95,10 @@ echo pow(-1, 5.5); // NAN &reftitle.seealso; + + Exponentiation operator + ** + fpow exp sqrt