mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-27 14:28:56 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@166882 c90b9560-bf6c-de11-be94-00142212c4b1
84 lines
2.4 KiB
XML
84 lines
2.4 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.6 $ -->
|
|
<refentry id="function.bcpowmod">
|
|
<refnamediv>
|
|
<refname>bcpowmod</refname>
|
|
<refpurpose>
|
|
Raise an arbitrary precision number to another, reduced by a specified modulus
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>bcpowmod</methodname>
|
|
<methodparam><type>string</type><parameter>x</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>y</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>modulus</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>scale</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Use the fast-exponentiation method to raise <parameter>x</parameter>
|
|
to the power <parameter>y</parameter> with respect to the modulus
|
|
<parameter>modulus</parameter>. The optional
|
|
<parameter>scale</parameter> can be used to set the number of
|
|
digits after the decimal place in the result.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Because this method uses the modulus operation, non-natural numbers
|
|
may give unexpected results. A natural number is any positive
|
|
non-zero integer.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
<refsect1>
|
|
&reftitle.examples;
|
|
<para>
|
|
The following two statements are functionally identical. The
|
|
<function>bcpowmod</function> version however, executes in
|
|
less time and can accept larger parameters.
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$a = bcpowmod($x, $y, $mod);
|
|
|
|
$b = bcmod(bcpow($x, $y), $mod);
|
|
|
|
// $a and $b are equal to each other.
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1>
|
|
&reftitle.seealso;
|
|
<para>
|
|
<function>bcpow</function>&listendand;
|
|
<function>bcmod</function>.
|
|
</para>
|
|
</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:"../../../../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
|
|
-->
|