2002-12-10 20:33:41 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2004-08-20 09:37:01 +00:00
|
|
|
<!-- $Revision: 1.6 $ -->
|
2002-12-11 16:34:54 +00:00
|
|
|
<refentry id="function.bcpowmod">
|
2002-12-10 20:33:41 +00:00
|
|
|
<refnamediv>
|
2002-12-11 16:34:54 +00:00
|
|
|
<refname>bcpowmod</refname>
|
2002-12-10 20:33:41 +00:00
|
|
|
<refpurpose>
|
2004-08-20 09:37:01 +00:00
|
|
|
Raise an arbitrary precision number to another, reduced by a specified modulus
|
2002-12-10 20:33:41 +00:00
|
|
|
</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
2002-12-11 16:34:54 +00:00
|
|
|
<type>string</type><methodname>bcpowmod</methodname>
|
2002-12-10 20:33:41 +00:00
|
|
|
<methodparam><type>string</type><parameter>x</parameter></methodparam>
|
2003-03-31 19:39:31 +00:00
|
|
|
<methodparam><type>string</type><parameter>y</parameter></methodparam>
|
2002-12-10 20:33:41 +00:00
|
|
|
<methodparam><type>string</type><parameter>modulus</parameter></methodparam>
|
|
|
|
<methodparam choice="opt"><type>int</type><parameter>scale</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
2004-08-10 23:40:27 +00:00
|
|
|
<para>
|
2002-12-10 20:33:41 +00:00
|
|
|
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.
|
2004-08-10 23:40:27 +00:00
|
|
|
</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;
|
2002-12-10 20:33:41 +00:00
|
|
|
<para>
|
|
|
|
The following two statements are functionally identical. The
|
2002-12-11 16:34:54 +00:00
|
|
|
<function>bcpowmod</function> version however, executes in
|
2002-12-10 20:33:41 +00:00
|
|
|
less time and can accept larger parameters.
|
|
|
|
<informalexample>
|
2002-12-11 16:34:54 +00:00
|
|
|
<programlisting role="php">
|
2002-12-10 20:33:41 +00:00
|
|
|
<![CDATA[
|
2002-12-11 16:34:54 +00:00
|
|
|
<?php
|
2003-12-15 16:55:22 +00:00
|
|
|
$a = bcpowmod($x, $y, $mod);
|
2002-12-10 20:33:41 +00:00
|
|
|
|
2003-12-15 16:55:22 +00:00
|
|
|
$b = bcmod(bcpow($x, $y), $mod);
|
|
|
|
|
|
|
|
// $a and $b are equal to each other.
|
2002-12-11 16:34:54 +00:00
|
|
|
|
|
|
|
?>
|
2002-12-10 20:33:41 +00:00
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</informalexample>
|
|
|
|
</para>
|
2004-08-10 23:40:27 +00:00
|
|
|
</refsect1>
|
|
|
|
<refsect1>
|
|
|
|
&reftitle.seealso;
|
2002-12-10 20:33:41 +00:00
|
|
|
<para>
|
2004-08-10 23:40:27 +00:00
|
|
|
<function>bcpow</function>&listendand;
|
2002-12-10 20:33:41 +00:00
|
|
|
<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
|
|
|
|
-->
|