Skip to content

Commit

Permalink
PHP-8.4: Document fpow()
Browse files Browse the repository at this point in the history
  • Loading branch information
Girgias committed Nov 11, 2024
1 parent b6c220c commit b0a8da1
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 2 deletions.
4 changes: 2 additions & 2 deletions reference/math/functions/fdiv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ var_dump(fdiv(0.0, 0.0)); // float(NAN)
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="language.operators.arithmetic"><literal>/</literal></link> - Floating-point division</member>
<member><function>intdiv</function> - Integer division</member>
<member><function>fmod</function> - Modulus</member>
<member><function>fmod</function></member>
<member><function>fpow</function></member>
</simplelist>
</para>
</refsect1>
Expand Down
113 changes: 113 additions & 0 deletions reference/math/functions/fpow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="function.fpow" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>fpow</refname>
<refpurpose>Raise one number to the power of another, according to IEEE 754</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>float</type><methodname>fpow</methodname>
<methodparam><type>float</type><parameter>num1</parameter></methodparam>
<methodparam><type>float</type><parameter>num2</parameter></methodparam>
</methodsynopsis>
<simpara>
Returns the floating point result of raising
<parameter>num1</parameter> to the power of <parameter>num2</parameter>.
If <parameter>num1</parameter> is zero and <parameter>num2</parameter>
is less than zero, then <constant>INF</constant> is returned.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<simpara>
<variablelist>
<varlistentry>
<term><parameter>num1</parameter></term>
<listitem>
<simpara>
The base to number.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>num2</parameter></term>
<listitem>
<simpara>
The exponent.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simpara>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Returns a <type>float</type> corresponding to
<literal><parameter>num1</parameter><superscript><parameter>num2</parameter></superscript></literal>.
</simpara>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example xml:id="function.fpow.example.basic">
<title><function>fpow</function> example</title>
<simpara>
Description.
</simpara>
<programlisting role="php">
<![CDATA[
<?php
var_dump(fpow(0, -3));
var_dump(fpow(-1, 5.5));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
float(INF)
float(NAN)
]]>
</screen>
</example>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><link linkend="language.operators.arithmetic"><literal>/</literal></link> - Floating-point division</member>
<member><function>pow</function></member>
<member><function>fdiv</function></member>
<member><function>fmod</function></member>
<!-- TODO ** operator link?
<member><link linkend="some.id.chunk.to.link">something appendix</link></member>
-->
</simplelist>
</refsect1>

</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
1 change: 1 addition & 0 deletions reference/math/functions/pow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ echo pow(-1, 5.5); // NAN
&reftitle.seealso;
<para>
<simplelist>
<member><function>fpow</function></member>
<member><function>exp</function></member>
<member><function>sqrt</function></member>
<member><function>bcpow</function></member>
Expand Down
1 change: 1 addition & 0 deletions reference/math/versions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<function name="fdiv" from="PHP 8"/>
<function name="floor" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
<function name="fmod" from="PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8"/>
<function name="fpow" from="PHP 8 &gt;= 8.4.0"/>
<function name="hexdec" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
<function name="hypot" from="PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8"/>
<function name="is_finite" from="PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8"/>
Expand Down

0 comments on commit b0a8da1

Please sign in to comment.