mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
WS, preparation for the new doc style
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@238021 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
b34edb705d
commit
07b50d3fc8
39 changed files with 1268 additions and 1270 deletions
|
@ -1,23 +1,23 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-abs">
|
||||
<refnamediv>
|
||||
<refname>gmp_abs</refname>
|
||||
<refpurpose>Absolute value</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_abs</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns absolute value of <parameter>a</parameter>.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_abs</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-abs">
|
||||
<refnamediv>
|
||||
<refname>gmp_abs</refname>
|
||||
<refpurpose>Absolute value</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_abs</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns absolute value of <parameter>a</parameter>.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_abs</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$abs1 = gmp_abs("274982683358");
|
||||
|
@ -27,19 +27,19 @@ echo gmp_strval($abs1) . "\n";
|
|||
echo gmp_strval($abs2) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
274982683358
|
||||
274982683358
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,43 +1,43 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-add">
|
||||
<refnamediv>
|
||||
<refname>gmp_add</refname>
|
||||
<refpurpose>Add numbers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_add</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Add two GMP numbers. The result will be a GMP number representing
|
||||
the sum of the arguments.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_add</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-add">
|
||||
<refnamediv>
|
||||
<refname>gmp_add</refname>
|
||||
<refpurpose>Add numbers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_add</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Add two GMP numbers. The result will be a GMP number representing
|
||||
the sum of the arguments.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_add</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$sum = gmp_add("123456789012345", "76543210987655");
|
||||
echo gmp_strval($sum) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
200000000000000
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-and">
|
||||
<refnamediv>
|
||||
<refname>gmp_and</refname>
|
||||
<refpurpose>Logical AND</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_and</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates logical AND of two GMP numbers.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_and</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-and">
|
||||
<refnamediv>
|
||||
<refname>gmp_and</refname>
|
||||
<refpurpose>Logical AND</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_and</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates logical AND of two GMP numbers.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_and</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$and1 = gmp_and("0xfffffffff4", "0x4");
|
||||
|
@ -27,19 +27,19 @@ echo gmp_strval($and1) . "\n";
|
|||
echo gmp_strval($and2) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
4
|
||||
0
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-clrbit">
|
||||
<refnamediv>
|
||||
<refname>gmp_clrbit</refname>
|
||||
<refpurpose>Clear bit</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>gmp_clrbit</methodname>
|
||||
<methodparam><type>resource</type><parameter role="reference">a</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>index</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Clears (sets to 0) bit <parameter>index</parameter> in
|
||||
<parameter>a</parameter>. The index starts at 0.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Unlike most of the other GMP functions, <function>gmp_clrbit</function>
|
||||
must be called with a GMP resource that already exists (using
|
||||
<function>gmp_init</function> for example). One will not be
|
||||
automatically created.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title><function>gmp_clrbit</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-clrbit">
|
||||
<refnamediv>
|
||||
<refname>gmp_clrbit</refname>
|
||||
<refpurpose>Clear bit</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>gmp_clrbit</methodname>
|
||||
<methodparam><type>resource</type><parameter role="reference">a</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>index</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Clears (sets to 0) bit <parameter>index</parameter> in
|
||||
<parameter>a</parameter>. The index starts at 0.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Unlike most of the other GMP functions, <function>gmp_clrbit</function>
|
||||
must be called with a GMP resource that already exists (using
|
||||
<function>gmp_init</function> for example). One will not be
|
||||
automatically created.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title><function>gmp_clrbit</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$a = gmp_init("0xff");
|
||||
|
@ -35,22 +35,22 @@ gmp_clrbit($a, 0); // index starts at 0, least significant bit
|
|||
echo gmp_strval($a) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
254
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
See also <function>gmp_setbit</function> and
|
||||
<function>gmp_testbit</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
See also <function>gmp_setbit</function> and
|
||||
<function>gmp_testbit</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-cmp">
|
||||
<refnamediv>
|
||||
<refname>gmp_cmp</refname>
|
||||
<refpurpose>Compare numbers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_cmp</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns a positive value if <literal>a > b</literal>, zero if
|
||||
<literal>a = b</literal> and a negative value if <literal>a <
|
||||
b</literal>.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_cmp</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-cmp">
|
||||
<refnamediv>
|
||||
<refname>gmp_cmp</refname>
|
||||
<refpurpose>Compare numbers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_cmp</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns a positive value if <literal>a > b</literal>, zero if
|
||||
<literal>a = b</literal> and a negative value if <literal>a <
|
||||
b</literal>.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_cmp</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$cmp1 = gmp_cmp("1234", "1000"); // greater than
|
||||
|
@ -30,18 +30,18 @@ $cmp3 = gmp_cmp("1234", "1234"); // equal to
|
|||
echo "$cmp1 $cmp2 $cmp3\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
1 -1 0
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.20 -->
|
||||
<refentry id='function.gmp-com'>
|
||||
<refnamediv>
|
||||
<refname>gmp_com</refname>
|
||||
<refpurpose>Calculates one's complement</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_com</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the one's complement of <parameter>a</parameter>.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_com</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id='function.gmp-com'>
|
||||
<refnamediv>
|
||||
<refname>gmp_com</refname>
|
||||
<refpurpose>Calculates one's complement</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_com</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the one's complement of <parameter>a</parameter>.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_com</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$com = gmp_com("1234");
|
||||
echo gmp_strval($com) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
-1235
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</screen>
|
||||
</example>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-div-q">
|
||||
<refnamediv>
|
||||
<refname>gmp_div_q</refname>
|
||||
<refpurpose>Divide numbers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_div_q</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>round</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Divides <parameter>a</parameter> by <parameter>b</parameter> and
|
||||
returns the integer result. The result rounding is defined by the
|
||||
<parameter>round</parameter>, which can have the following
|
||||
values:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<parameter>GMP_ROUND_ZERO</parameter>: The result is truncated
|
||||
towards 0.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<parameter>GMP_ROUND_PLUSINF</parameter>: The result is
|
||||
rounded towards <literal>+infinity</literal>.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<parameter>GMP_ROUND_MINUSINF</parameter>: The result is
|
||||
rounded towards <literal>-infinity</literal>.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<simpara>
|
||||
This function can also be called as <function>gmp_div</function>.
|
||||
</simpara>
|
||||
<example>
|
||||
<title><function>gmp_div_q</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-div-q">
|
||||
<refnamediv>
|
||||
<refname>gmp_div_q</refname>
|
||||
<refpurpose>Divide numbers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_div_q</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>round</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Divides <parameter>a</parameter> by <parameter>b</parameter> and
|
||||
returns the integer result. The result rounding is defined by the
|
||||
<parameter>round</parameter>, which can have the following
|
||||
values:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<parameter>GMP_ROUND_ZERO</parameter>: The result is truncated
|
||||
towards 0.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<parameter>GMP_ROUND_PLUSINF</parameter>: The result is
|
||||
rounded towards <literal>+infinity</literal>.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<parameter>GMP_ROUND_MINUSINF</parameter>: The result is
|
||||
rounded towards <literal>-infinity</literal>.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<simpara>
|
||||
This function can also be called as <function>gmp_div</function>.
|
||||
</simpara>
|
||||
<example>
|
||||
<title><function>gmp_div_q</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$div1 = gmp_div_q("100", "5");
|
||||
|
@ -64,11 +64,11 @@ $div5 = gmp_div_q("-1", "4", GMP_ROUND_MINUSINF);
|
|||
echo gmp_strval($div5) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
20
|
||||
0
|
||||
|
@ -76,14 +76,14 @@ echo gmp_strval($div5) . "\n";
|
|||
0
|
||||
-1
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
See also <function>gmp_div_r</function>,
|
||||
<function>gmp_div_qr</function>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
See also <function>gmp_div_r</function>,
|
||||
<function>gmp_div_qr</function>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-div-qr">
|
||||
<refnamediv>
|
||||
<refname>gmp_div_qr</refname>
|
||||
<refpurpose>Divide numbers and get quotient and remainder</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>gmp_div_qr</methodname>
|
||||
<methodparam><type>resource</type><parameter>n</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>d</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>round</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
The function divides <parameter>n</parameter> by
|
||||
<parameter>d</parameter> and returns array, with the first
|
||||
element being <literal>[n/d]</literal> (the integer result of the
|
||||
division) and the second being <literal>(n - [n/d] * d)</literal>
|
||||
(the remainder of the division).
|
||||
</para>
|
||||
<para>
|
||||
See the <function>gmp_div_q</function> function for description
|
||||
of the <parameter>round</parameter> argument.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Division of GMP numbers</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-div-qr">
|
||||
<refnamediv>
|
||||
<refname>gmp_div_qr</refname>
|
||||
<refpurpose>Divide numbers and get quotient and remainder</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>gmp_div_qr</methodname>
|
||||
<methodparam><type>resource</type><parameter>n</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>d</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>round</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
The function divides <parameter>n</parameter> by
|
||||
<parameter>d</parameter> and returns array, with the first
|
||||
element being <literal>[n/d]</literal> (the integer result of the
|
||||
division) and the second being <literal>(n - [n/d] * d)</literal>
|
||||
(the remainder of the division).
|
||||
</para>
|
||||
<para>
|
||||
See the <function>gmp_div_q</function> function for description
|
||||
of the <parameter>round</parameter> argument.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Division of GMP numbers</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$a = gmp_init("0x41682179fbf5");
|
||||
$res = gmp_div_qr($a, "0xDEFE75");
|
||||
printf("Result is: q - %s, r - %s",
|
||||
printf("Result is: q - %s, r - %s",
|
||||
gmp_strval($res[0]), gmp_strval($res[1]));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>gmp_div_q</function>,
|
||||
<function>gmp_div_r</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <function>gmp_div_q</function>,
|
||||
<function>gmp_div_r</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,54 +1,54 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-div-r">
|
||||
<refnamediv>
|
||||
<refname>gmp_div_r</refname>
|
||||
<refpurpose>Remainder of the division of numbers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_div_r</methodname>
|
||||
<methodparam><type>resource</type><parameter>n</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>d</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>round</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates remainder of the integer division of
|
||||
<parameter>n</parameter> by <parameter>d</parameter>. The
|
||||
remainder has the sign of the <parameter>n</parameter> argument,
|
||||
if not zero.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_div_r</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-div-r">
|
||||
<refnamediv>
|
||||
<refname>gmp_div_r</refname>
|
||||
<refpurpose>Remainder of the division of numbers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_div_r</methodname>
|
||||
<methodparam><type>resource</type><parameter>n</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>d</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>round</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates remainder of the integer division of
|
||||
<parameter>n</parameter> by <parameter>d</parameter>. The
|
||||
remainder has the sign of the <parameter>n</parameter> argument,
|
||||
if not zero.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_div_r</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$div = gmp_div_r("105", "20");
|
||||
echo gmp_strval($div) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
5
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
See the <function>gmp_div_q</function> function for description
|
||||
of the <parameter>round</parameter> argument.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>gmp_div_q</function>,
|
||||
<function>gmp_div_qr</function>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
See the <function>gmp_div_q</function> function for description
|
||||
of the <parameter>round</parameter> argument.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>gmp_div_q</function>,
|
||||
<function>gmp_div_qr</function>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-divexact">
|
||||
<refnamediv>
|
||||
<refname>gmp_divexact</refname>
|
||||
<refpurpose>Exact division of numbers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_divexact</methodname>
|
||||
<methodparam><type>resource</type><parameter>n</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>d</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Divides <parameter>n</parameter> by <parameter>d</parameter>,
|
||||
using fast "exact division" algorithm. This function produces
|
||||
correct results only when it is known in advance that
|
||||
<parameter>d</parameter> divides <parameter>n</parameter>.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_divexact</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-divexact">
|
||||
<refnamediv>
|
||||
<refname>gmp_divexact</refname>
|
||||
<refpurpose>Exact division of numbers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_divexact</methodname>
|
||||
<methodparam><type>resource</type><parameter>n</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>d</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Divides <parameter>n</parameter> by <parameter>d</parameter>,
|
||||
using fast "exact division" algorithm. This function produces
|
||||
correct results only when it is known in advance that
|
||||
<parameter>d</parameter> divides <parameter>n</parameter>.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_divexact</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$div1 = gmp_divexact("10", "2");
|
||||
|
@ -31,19 +31,19 @@ $div2 = gmp_divexact("10", "3"); // bogus result
|
|||
echo gmp_strval($div2) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
5
|
||||
2863311534
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-fact">
|
||||
<refnamediv>
|
||||
<refname>gmp_fact</refname>
|
||||
<refpurpose>Factorial</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_fact</methodname>
|
||||
<methodparam><type>int</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates factorial (<literal>a!</literal>) of <parameter>a</parameter>.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_fact</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-fact">
|
||||
<refnamediv>
|
||||
<refname>gmp_fact</refname>
|
||||
<refpurpose>Factorial</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_fact</methodname>
|
||||
<methodparam><type>int</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates factorial (<literal>a!</literal>) of <parameter>a</parameter>.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_fact</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$fact1 = gmp_fact(5); // 5 * 4 * 3 * 2 * 1
|
||||
|
@ -27,19 +27,19 @@ $fact2 = gmp_fact(50); // 50 * 49 * 48, ... etc
|
|||
echo gmp_strval($fact2) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
120
|
||||
30414093201713378043612608166064768844377641568960512000000000000
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-gcd">
|
||||
<refnamediv>
|
||||
<refname>gmp_gcd</refname>
|
||||
<refpurpose>Calculate GCD</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_gcd</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculate greatest common divisor of <parameter>a</parameter> and
|
||||
<parameter>b</parameter>. The result is always positive even if
|
||||
either of, or both, input operands are negative.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_gcd</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-gcd">
|
||||
<refnamediv>
|
||||
<refname>gmp_gcd</refname>
|
||||
<refpurpose>Calculate GCD</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_gcd</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculate greatest common divisor of <parameter>a</parameter> and
|
||||
<parameter>b</parameter>. The result is always positive even if
|
||||
either of, or both, input operands are negative.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_gcd</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$gcd = gmp_gcd("12", "21");
|
||||
echo gmp_strval($gcd) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
3
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-gcdext">
|
||||
<refnamediv>
|
||||
<refname>gmp_gcdext</refname>
|
||||
<refpurpose>Calculate GCD and multipliers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>gmp_gcdext</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates g, s, and t, such that <literal>a*s + b*t = g =
|
||||
gcd(a,b)</literal>, where gcd is the greatest common divisor. Returns
|
||||
an array with respective elements g, s and t.
|
||||
</para>
|
||||
<para>
|
||||
This function can be used to solve linear Diophantine equations in two
|
||||
variables. These are equations that allow only integer solutions and have the form:
|
||||
<literal>a*x + b*y = c</literal>.
|
||||
For more information, go to the <ulink url="&url.diophantine-equation;">"Diophantine
|
||||
Equation" page at MathWorld</ulink>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Solving a linear Diophantine equation</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-gcdext">
|
||||
<refnamediv>
|
||||
<refname>gmp_gcdext</refname>
|
||||
<refpurpose>Calculate GCD and multipliers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>gmp_gcdext</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates g, s, and t, such that <literal>a*s + b*t = g =
|
||||
gcd(a,b)</literal>, where gcd is the greatest common divisor. Returns
|
||||
an array with respective elements g, s and t.
|
||||
</para>
|
||||
<para>
|
||||
This function can be used to solve linear Diophantine equations in two
|
||||
variables. These are equations that allow only integer solutions and have the form:
|
||||
<literal>a*x + b*y = c</literal>.
|
||||
For more information, go to the <ulink url="&url.diophantine-equation;">"Diophantine
|
||||
Equation" page at MathWorld</ulink>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Solving a linear Diophantine equation</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Solve the equation a*s + b*t = g
|
||||
|
@ -49,15 +49,15 @@ if ($check_gcd && $check_res) {
|
|||
} else {
|
||||
echo "Error while solving the equation\n";
|
||||
}
|
||||
|
||||
|
||||
// output: Solution: 12*2 + 21*-1 = 3
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-hamdist">
|
||||
<refnamediv>
|
||||
<refname>gmp_hamdist</refname>
|
||||
<refpurpose>Hamming distance</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_hamdist</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the hamming distance between <parameter>a</parameter> and
|
||||
<parameter>b</parameter>. Both operands should be non-negative.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_hamdist</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-hamdist">
|
||||
<refnamediv>
|
||||
<refname>gmp_hamdist</refname>
|
||||
<refpurpose>Hamming distance</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_hamdist</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the hamming distance between <parameter>a</parameter> and
|
||||
<parameter>b</parameter>. Both operands should be non-negative.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_hamdist</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$ham1 = gmp_init("1001010011", 2);
|
||||
|
@ -30,23 +30,23 @@ echo gmp_hamdist($ham1, $ham2) . "\n";
|
|||
echo gmp_popcount(gmp_xor($ham1, $ham2)) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
6
|
||||
6
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
See also <function>gmp_popcount</function>,
|
||||
<function>gmp_xor</function>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
See also <function>gmp_popcount</function>,
|
||||
<function>gmp_xor</function>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,57 +1,57 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-init">
|
||||
<refnamediv>
|
||||
<refname>gmp_init</refname>
|
||||
<refpurpose>Create GMP number</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_init</methodname>
|
||||
<methodparam><type>mixed</type><parameter>number</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>base</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Creates a GMP number from an integer or string. String
|
||||
representation can be decimal, hexadecimal or octal.
|
||||
Optional parameter <parameter>base</parameter> is available since
|
||||
PHP 4.1.0. Its default value is <literal>0</literal>.
|
||||
</para>
|
||||
<para>
|
||||
The base may vary from 2 to 36. If base is 0 (default value), the
|
||||
actual base is determined from the leading characters: if the first
|
||||
two characters are <literal>0x</literal> or <literal>0X</literal>,
|
||||
hexadecimal is assumed, otherwise if the first character is "0",
|
||||
octal is assumed, otherwise decimal is assumed.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Creating GMP number</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-init">
|
||||
<refnamediv>
|
||||
<refname>gmp_init</refname>
|
||||
<refpurpose>Create GMP number</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_init</methodname>
|
||||
<methodparam><type>mixed</type><parameter>number</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>base</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Creates a GMP number from an integer or string. String
|
||||
representation can be decimal, hexadecimal or octal.
|
||||
Optional parameter <parameter>base</parameter> is available since
|
||||
PHP 4.1.0. Its default value is <literal>0</literal>.
|
||||
</para>
|
||||
<para>
|
||||
The base may vary from 2 to 36. If base is 0 (default value), the
|
||||
actual base is determined from the leading characters: if the first
|
||||
two characters are <literal>0x</literal> or <literal>0X</literal>,
|
||||
hexadecimal is assumed, otherwise if the first character is "0",
|
||||
octal is assumed, otherwise decimal is assumed.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Creating GMP number</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$a = gmp_init(123456);
|
||||
$b = gmp_init("0xFFFFDEBACDFEDF7200");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
It is not necessary to call this function if you want to use
|
||||
integer or string in place of GMP number in GMP functions, like
|
||||
<function>gmp_add</function>. Function arguments are
|
||||
automatically converted to GMP numbers, if such conversion is
|
||||
possible and needed, using the same rules as
|
||||
<function>gmp_init</function>.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<note>
|
||||
<para>
|
||||
It is not necessary to call this function if you want to use
|
||||
integer or string in place of GMP number in GMP functions, like
|
||||
<function>gmp_add</function>. Function arguments are
|
||||
automatically converted to GMP numbers, if such conversion is
|
||||
possible and needed, using the same rules as
|
||||
<function>gmp_init</function>.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-intval">
|
||||
<refnamediv>
|
||||
<refname>gmp_intval</refname>
|
||||
<refpurpose>Convert GMP number to integer</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_intval</methodname>
|
||||
<methodparam><type>resource</type><parameter>gmpnumber</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function allows to convert GMP number to integer.
|
||||
<warning>
|
||||
<simpara>
|
||||
This function returns a useful result only if the number actually
|
||||
fits the PHP integer (i.e., signed long type). If you want just
|
||||
to print the GMP number, use <function>gmp_strval</function>.
|
||||
</simpara>
|
||||
</warning>
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_intval</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-intval">
|
||||
<refnamediv>
|
||||
<refname>gmp_intval</refname>
|
||||
<refpurpose>Convert GMP number to integer</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_intval</methodname>
|
||||
<methodparam><type>resource</type><parameter>gmpnumber</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function allows to convert GMP number to integer.
|
||||
<warning>
|
||||
<simpara>
|
||||
This function returns a useful result only if the number actually
|
||||
fits the PHP integer (i.e., signed long type). If you want just
|
||||
to print the GMP number, use <function>gmp_strval</function>.
|
||||
</simpara>
|
||||
</warning>
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_intval</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// displays correct result
|
||||
|
@ -37,20 +37,20 @@ echo gmp_intval("2147483648") . "\n";
|
|||
echo gmp_strval("2147483648") . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
2147483647
|
||||
2147483647
|
||||
2147483648
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-invert">
|
||||
<refnamediv>
|
||||
<refname>gmp_invert</refname>
|
||||
<refpurpose>Inverse by modulo</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_invert</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Computes the inverse of <parameter>a</parameter> modulo
|
||||
<parameter>b</parameter>. Returns &false; if an inverse does not
|
||||
exist.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_invert</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-invert">
|
||||
<refnamediv>
|
||||
<refname>gmp_invert</refname>
|
||||
<refpurpose>Inverse by modulo</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_invert</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Computes the inverse of <parameter>a</parameter> modulo
|
||||
<parameter>b</parameter>. Returns &false; if an inverse does not
|
||||
exist.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_invert</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
echo gmp_invert("5", "10"); // no inverse, outputs nothing, result is FALSE
|
||||
|
@ -28,18 +28,18 @@ $invert = gmp_invert("5", "11");
|
|||
echo gmp_strval($invert) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
9
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-jacobi">
|
||||
<refnamediv>
|
||||
<refname>gmp_jacobi</refname>
|
||||
<refpurpose>Jacobi symbol</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_jacobi</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>p</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Computes
|
||||
<ulink url="&url.jacobi;">
|
||||
Jacobi symbol</ulink> of <parameter>a</parameter> and
|
||||
<parameter>p</parameter>. <parameter>p</parameter> should be odd
|
||||
and must be positive.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_jacobi</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-jacobi">
|
||||
<refnamediv>
|
||||
<refname>gmp_jacobi</refname>
|
||||
<refpurpose>Jacobi symbol</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_jacobi</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>p</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Computes
|
||||
<ulink url="&url.jacobi;">
|
||||
Jacobi symbol</ulink> of <parameter>a</parameter> and
|
||||
<parameter>p</parameter>. <parameter>p</parameter> should be odd
|
||||
and must be positive.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_jacobi</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
echo gmp_jacobi("1", "3") . "\n";
|
||||
echo gmp_jacobi("2", "3") . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
1
|
||||
0
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-legendre">
|
||||
<refnamediv>
|
||||
<refname>gmp_legendre</refname>
|
||||
<refpurpose>Legendre symbol</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_legendre</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>p</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Compute the
|
||||
<ulink url="&url.symbole-legendre;">
|
||||
Legendre symbol</ulink> of <parameter>a</parameter> and
|
||||
<parameter>p</parameter>. <parameter>p</parameter> should be odd
|
||||
and must be positive.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_legendre</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-legendre">
|
||||
<refnamediv>
|
||||
<refname>gmp_legendre</refname>
|
||||
<refpurpose>Legendre symbol</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_legendre</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>p</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Compute the
|
||||
<ulink url="&url.symbole-legendre;">
|
||||
Legendre symbol</ulink> of <parameter>a</parameter> and
|
||||
<parameter>p</parameter>. <parameter>p</parameter> should be odd
|
||||
and must be positive.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_legendre</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
echo gmp_legendre("1", "3") . "\n";
|
||||
echo gmp_legendre("2", "3") . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
1
|
||||
0
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-mod">
|
||||
<refnamediv>
|
||||
<refname>gmp_mod</refname>
|
||||
<refpurpose>Modulo operation</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_mod</methodname>
|
||||
<methodparam><type>resource</type><parameter>n</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>d</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates <parameter>n</parameter> modulo
|
||||
<parameter>d</parameter>. The result is always non-negative, the
|
||||
sign of <parameter>d</parameter> is ignored.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_mod</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-mod">
|
||||
<refnamediv>
|
||||
<refname>gmp_mod</refname>
|
||||
<refpurpose>Modulo operation</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_mod</methodname>
|
||||
<methodparam><type>resource</type><parameter>n</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>d</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates <parameter>n</parameter> modulo
|
||||
<parameter>d</parameter>. The result is always non-negative, the
|
||||
sign of <parameter>d</parameter> is ignored.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_mod</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$mod = gmp_mod("8", "3");
|
||||
echo gmp_strval($mod) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
2
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,43 +1,43 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-mul">
|
||||
<refnamediv>
|
||||
<refname>gmp_mul</refname>
|
||||
<refpurpose>Multiply numbers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_mul</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Multiplies <parameter>a</parameter> by <parameter>b</parameter>
|
||||
and returns the result.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_mul</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-mul">
|
||||
<refnamediv>
|
||||
<refname>gmp_mul</refname>
|
||||
<refpurpose>Multiply numbers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_mul</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Multiplies <parameter>a</parameter> by <parameter>b</parameter>
|
||||
and returns the result.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_mul</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$mul = gmp_mul("12345678", "2000");
|
||||
echo gmp_strval($mul) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
24691356000
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-neg">
|
||||
<refnamediv>
|
||||
<refname>gmp_neg</refname>
|
||||
<refpurpose>Negate number</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_neg</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns -<parameter>a</parameter>.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_neg</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-neg">
|
||||
<refnamediv>
|
||||
<refname>gmp_neg</refname>
|
||||
<refpurpose>Negate number</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_neg</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns -<parameter>a</parameter>.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_neg</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$neg1 = gmp_neg("1");
|
||||
$neg1 = gmp_neg("1");
|
||||
echo gmp_strval($neg1) . "\n";
|
||||
$neg2 = gmp_neg("-1");
|
||||
echo gmp_strval($neg2) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
-1
|
||||
1
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.gmp-nextprime">
|
||||
<refnamediv>
|
||||
<refname>gmp_nextprime</refname>
|
||||
<refpurpose>Find next prime number</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_nextprime</methodname>
|
||||
<methodparam><type>int</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Return next prime number greater than <parameter>a</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
This function uses a probabilistic algorithm to identify primes and
|
||||
chances to get a composite number are extremely small.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_nextprime</function> example</title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.gmp-nextprime">
|
||||
<refnamediv>
|
||||
<refname>gmp_nextprime</refname>
|
||||
<refpurpose>Find next prime number</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_nextprime</methodname>
|
||||
<methodparam><type>int</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Return next prime number greater than <parameter>a</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
This function uses a probabilistic algorithm to identify primes and
|
||||
chances to get a composite number are extremely small.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_nextprime</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$prime1 = gmp_nextprime(10); // next prime number greater than 10
|
||||
|
@ -30,19 +30,19 @@ echo gmp_strval($prime1) . "\n";
|
|||
echo gmp_strval($prime2) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program is:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program is:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
11
|
||||
-997
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-or">
|
||||
<refnamediv>
|
||||
<refname>gmp_or</refname>
|
||||
<refpurpose>Logical OR</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_or</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates logical inclusive OR of two GMP numbers.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_or</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-or">
|
||||
<refnamediv>
|
||||
<refname>gmp_or</refname>
|
||||
<refpurpose>Logical OR</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_or</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates logical inclusive OR of two GMP numbers.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_or</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$or1 = gmp_or("0xfffffff2", "4");
|
||||
|
@ -27,19 +27,19 @@ $or2 = gmp_or("0xfffffff2", "2");
|
|||
echo gmp_strval($or2, 16) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
fffffff6
|
||||
fffffff2
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-perfect-square">
|
||||
<refnamediv>
|
||||
<refname>gmp_perfect_square</refname>
|
||||
<refpurpose>Perfect square check</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>gmp_perfect_square</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns &true; if <parameter>a</parameter> is a perfect square,
|
||||
&false; otherwise.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_perfect_square</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-perfect-square">
|
||||
<refnamediv>
|
||||
<refname>gmp_perfect_square</refname>
|
||||
<refpurpose>Perfect square check</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>gmp_perfect_square</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns &true; if <parameter>a</parameter> is a perfect square,
|
||||
&false; otherwise.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_perfect_square</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// 3 * 3, perfect square
|
||||
|
@ -31,24 +31,24 @@ var_dump(gmp_perfect_square("7"));
|
|||
var_dump(gmp_perfect_square("1524157875019052100"));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
See also: <function>gmp_sqrt</function>,
|
||||
<function>gmp_sqrtrem</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
See also: <function>gmp_sqrt</function>,
|
||||
<function>gmp_sqrtrem</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-popcount">
|
||||
<refnamediv>
|
||||
<refname>gmp_popcount</refname>
|
||||
<refpurpose>Population count</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_popcount</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Return the population count of <parameter>a</parameter>.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_popcount</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-popcount">
|
||||
<refnamediv>
|
||||
<refname>gmp_popcount</refname>
|
||||
<refpurpose>Population count</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_popcount</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Return the population count of <parameter>a</parameter>.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_popcount</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$pop1 = gmp_init("10000101", 2); // 3 1's
|
||||
|
@ -26,19 +26,19 @@ $pop2 = gmp_init("11111110", 2); // 7 1's
|
|||
echo gmp_popcount($pop2) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
3
|
||||
7
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-pow">
|
||||
<refnamediv>
|
||||
<refname>gmp_pow</refname>
|
||||
<refpurpose>Raise number into power</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_pow</methodname>
|
||||
<methodparam><type>resource</type><parameter>base</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>exp</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Raise <parameter>base</parameter> into power
|
||||
<parameter>exp</parameter>. The case of 0^0 yields
|
||||
1. <parameter>exp</parameter> cannot be negative.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_pow</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-pow">
|
||||
<refnamediv>
|
||||
<refname>gmp_pow</refname>
|
||||
<refpurpose>Raise number into power</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_pow</methodname>
|
||||
<methodparam><type>resource</type><parameter>base</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>exp</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Raise <parameter>base</parameter> into power
|
||||
<parameter>exp</parameter>. The case of 0^0 yields
|
||||
1. <parameter>exp</parameter> cannot be negative.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_pow</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$pow1 = gmp_pow("2", 31);
|
||||
|
@ -31,19 +31,19 @@ $pow3 = gmp_pow("2", -1); // Negative exp, generates warning
|
|||
echo gmp_strval($pow3) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
2147483648
|
||||
1
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,45 +1,45 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-powm">
|
||||
<refnamediv>
|
||||
<refname>gmp_powm</refname>
|
||||
<refpurpose>Raise number into power with modulo</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_powm</methodname>
|
||||
<methodparam><type>resource</type><parameter>base</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>exp</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>mod</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculate (<parameter>base</parameter> raised into power
|
||||
<parameter>exp</parameter>) modulo <parameter>mod</parameter>. If
|
||||
<parameter>exp</parameter> is negative, result is undefined.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_powm</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-powm">
|
||||
<refnamediv>
|
||||
<refname>gmp_powm</refname>
|
||||
<refpurpose>Raise number into power with modulo</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_powm</methodname>
|
||||
<methodparam><type>resource</type><parameter>base</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>exp</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>mod</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculate (<parameter>base</parameter> raised into power
|
||||
<parameter>exp</parameter>) modulo <parameter>mod</parameter>. If
|
||||
<parameter>exp</parameter> is negative, result is undefined.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_powm</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$pow1 = gmp_powm("2", "31", "2147483649");
|
||||
echo gmp_strval($pow1) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
2147483648
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-prob-prime">
|
||||
<refnamediv>
|
||||
<refname>gmp_prob_prime</refname>
|
||||
<refpurpose>Check if number is "probably prime"</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_prob_prime</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>reps</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
If this function returns 0, <parameter>a</parameter> is
|
||||
definitely not prime. If it returns 1, then
|
||||
<parameter>a</parameter> is "probably" prime. If it returns 2,
|
||||
then <parameter>a</parameter> is surely prime. Reasonable values
|
||||
of <parameter>reps</parameter> vary from 5 to 10 (default being
|
||||
10); a higher value lowers the probability for a non-prime to
|
||||
pass as a "probable" prime.
|
||||
</para>
|
||||
<para>
|
||||
The function uses Miller-Rabin's probabilistic test.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_prob_prime</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-prob-prime">
|
||||
<refnamediv>
|
||||
<refname>gmp_prob_prime</refname>
|
||||
<refpurpose>Check if number is "probably prime"</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_prob_prime</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>reps</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
If this function returns 0, <parameter>a</parameter> is
|
||||
definitely not prime. If it returns 1, then
|
||||
<parameter>a</parameter> is "probably" prime. If it returns 2,
|
||||
then <parameter>a</parameter> is surely prime. Reasonable values
|
||||
of <parameter>reps</parameter> vary from 5 to 10 (default being
|
||||
10); a higher value lowers the probability for a non-prime to
|
||||
pass as a "probable" prime.
|
||||
</para>
|
||||
<para>
|
||||
The function uses Miller-Rabin's probabilistic test.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_prob_prime</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// definitely not a prime
|
||||
|
@ -40,20 +40,20 @@ echo gmp_prob_prime("1111111111111111111") . "\n";
|
|||
echo gmp_prob_prime("11") . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
0
|
||||
1
|
||||
2
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-random">
|
||||
<refnamediv>
|
||||
<refname>gmp_random</refname>
|
||||
<refpurpose>Random number</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_random</methodname>
|
||||
<methodparam><type>int</type><parameter>limiter</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Generate a random number. The number will be between
|
||||
zero and the number of bits per limb multiplied by
|
||||
<parameter>limiter</parameter>. If <parameter>limiter</parameter>
|
||||
is negative, negative numbers are generated.
|
||||
</para>
|
||||
<para>
|
||||
A limb is an internal GMP mechanism. The number of bits in a limb is
|
||||
not static, and can vary from system to system. Generally, the number
|
||||
of bits in a limb is either 16 or 32, but this is not guaranteed.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_random</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-random">
|
||||
<refnamediv>
|
||||
<refname>gmp_random</refname>
|
||||
<refpurpose>Random number</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_random</methodname>
|
||||
<methodparam><type>int</type><parameter>limiter</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Generate a random number. The number will be between
|
||||
zero and the number of bits per limb multiplied by
|
||||
<parameter>limiter</parameter>. If <parameter>limiter</parameter>
|
||||
is negative, negative numbers are generated.
|
||||
</para>
|
||||
<para>
|
||||
A limb is an internal GMP mechanism. The number of bits in a limb is
|
||||
not static, and can vary from system to system. Generally, the number
|
||||
of bits in a limb is either 16 or 32, but this is not guaranteed.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_random</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$rand1 = gmp_random(1); // random number from 0 to 1 * bits per limb
|
||||
|
@ -35,19 +35,19 @@ echo gmp_strval($rand1) . "\n";
|
|||
echo gmp_strval($rand2) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program might be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program might be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
1915834968
|
||||
8642564075890328087
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-scan0">
|
||||
<refnamediv>
|
||||
<refname>gmp_scan0</refname>
|
||||
<refpurpose>Scan for 0</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_scan0</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>start</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Scans <parameter>a</parameter>, starting with bit
|
||||
<parameter>start</parameter>, towards more significant bits,
|
||||
until the first clear bit is found. Returns the index of the
|
||||
found bit. The index starts from 0.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_scan0</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-scan0">
|
||||
<refnamediv>
|
||||
<refname>gmp_scan0</refname>
|
||||
<refpurpose>Scan for 0</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_scan0</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>start</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Scans <parameter>a</parameter>, starting with bit
|
||||
<parameter>start</parameter>, towards more significant bits,
|
||||
until the first clear bit is found. Returns the index of the
|
||||
found bit. The index starts from 0.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_scan0</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// "0" bit is found at position 3. index starts at 0
|
||||
|
@ -33,19 +33,19 @@ $s2 = gmp_init("101110000", 2);
|
|||
echo gmp_scan0($s2, 5) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
3
|
||||
7
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-scan1">
|
||||
<refnamediv>
|
||||
<refname>gmp_scan1</refname>
|
||||
<refpurpose>Scan for 1</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_scan1</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>start</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Scans <parameter>a</parameter>, starting with bit
|
||||
<parameter>start</parameter>, towards more significant bits,
|
||||
until the first set bit is found. Returns the index of the found
|
||||
bit. If no set bit is found, -1 is returned.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_scan1</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-scan1">
|
||||
<refnamediv>
|
||||
<refname>gmp_scan1</refname>
|
||||
<refpurpose>Scan for 1</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_scan1</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>start</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Scans <parameter>a</parameter>, starting with bit
|
||||
<parameter>start</parameter>, towards more significant bits,
|
||||
until the first set bit is found. Returns the index of the found
|
||||
bit. If no set bit is found, -1 is returned.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_scan1</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// "1" bit is found at position 3. index starts at 0
|
||||
|
@ -33,19 +33,19 @@ $s2 = gmp_init("01000001111", 2);
|
|||
echo gmp_scan1($s2, 5) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
3
|
||||
9
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-setbit">
|
||||
<refnamediv>
|
||||
<refname>gmp_setbit</refname>
|
||||
<refpurpose>Set bit</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>gmp_setbit</methodname>
|
||||
<methodparam><type>resource</type><parameter role="reference">a</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>index</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>set_clear</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Sets bit <parameter>index</parameter> in
|
||||
<parameter>a</parameter>. <parameter>set_clear</parameter>
|
||||
defines if the bit is set to 0 or 1. By default the bit is set to
|
||||
1. Index starts at 0.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Unlike most of the other GMP functions, <function>gmp_setbit</function>
|
||||
must be called with a GMP resource that already exists (using
|
||||
<function>gmp_init</function> for example). One will not be
|
||||
automatically created.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title><function>gmp_setbit</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-setbit">
|
||||
<refnamediv>
|
||||
<refname>gmp_setbit</refname>
|
||||
<refpurpose>Set bit</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>gmp_setbit</methodname>
|
||||
<methodparam><type>resource</type><parameter role="reference">a</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>index</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>set_clear</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Sets bit <parameter>index</parameter> in
|
||||
<parameter>a</parameter>. <parameter>set_clear</parameter>
|
||||
defines if the bit is set to 0 or 1. By default the bit is set to
|
||||
1. Index starts at 0.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Unlike most of the other GMP functions, <function>gmp_setbit</function>
|
||||
must be called with a GMP resource that already exists (using
|
||||
<function>gmp_init</function> for example). One will not be
|
||||
automatically created.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title><function>gmp_setbit</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$a = gmp_init("0xfd");
|
||||
|
@ -38,22 +38,22 @@ gmp_setbit($a, 1); // index starts at 0
|
|||
echo gmp_strval($a) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
255
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
See also <function>gmp_clrbit</function> and
|
||||
<function>gmp_testbit</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
See also <function>gmp_clrbit</function> and
|
||||
<function>gmp_testbit</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-sign">
|
||||
<refnamediv>
|
||||
<refname>gmp_sign</refname>
|
||||
<refpurpose>Sign of number</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_sign</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns 1 if <parameter>a</parameter> is positive,
|
||||
-1 if <parameter>a</parameter> is negative,
|
||||
and 0 if <parameter>a</parameter> is zero.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_sign</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-sign">
|
||||
<refnamediv>
|
||||
<refname>gmp_sign</refname>
|
||||
<refpurpose>Sign of number</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>gmp_sign</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns 1 if <parameter>a</parameter> is positive,
|
||||
-1 if <parameter>a</parameter> is negative,
|
||||
and 0 if <parameter>a</parameter> is zero.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_sign</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// positive
|
||||
|
@ -32,20 +32,20 @@ echo gmp_sign("-500") . "\n";
|
|||
echo gmp_sign("0") . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
1
|
||||
-1
|
||||
0
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-sqrt">
|
||||
<refnamediv>
|
||||
<refname>gmp_sqrt</refname>
|
||||
<refpurpose>Calculate square root</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_sqrt</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates square root of <parameter>a</parameter> and returns the
|
||||
integer portion of the result.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_sqrt</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-sqrt">
|
||||
<refnamediv>
|
||||
<refname>gmp_sqrt</refname>
|
||||
<refpurpose>Calculate square root</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_sqrt</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates square root of <parameter>a</parameter> and returns the
|
||||
integer portion of the result.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_sqrt</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$sqrt1 = gmp_sqrt("9");
|
||||
|
@ -30,20 +30,20 @@ echo gmp_strval($sqrt2) . "\n";
|
|||
echo gmp_strval($sqrt3) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
3
|
||||
2
|
||||
1234567890
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,53 +1,51 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<refentry id="function.gmp-sqrtrem">
|
||||
<refnamediv>
|
||||
<refname>gmp_sqrtrem</refname>
|
||||
<refpurpose>
|
||||
Square root with remainder
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>gmp_sqrtrem</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns array where first element is the integer square root of
|
||||
<parameter>a</parameter> (see also
|
||||
<function>gmp_sqrt</function>), and the second is the remainder
|
||||
(i.e., the difference between <parameter>a</parameter> and the
|
||||
first element squared).
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_sqrtrem</function> example</title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<refentry id="function.gmp-sqrtrem">
|
||||
<refnamediv>
|
||||
<refname>gmp_sqrtrem</refname>
|
||||
<refpurpose>Square root with remainder</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>gmp_sqrtrem</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns array where first element is the integer square root of
|
||||
<parameter>a</parameter> (see also
|
||||
<function>gmp_sqrt</function>), and the second is the remainder
|
||||
(i.e., the difference between <parameter>a</parameter> and the
|
||||
first element squared).
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_sqrtrem</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
list($sqrt1, $sqrt1rem) = gmp_sqrtrem("9");
|
||||
list($sqrt2, $sqrt2rem) = gmp_sqrtrem("7");
|
||||
list($sqrt3, $sqrt3rem) = gmp_sqrtrem("1048576");
|
||||
|
||||
echo gmp_strval($sqrt1) . ", " . gmp_strval($sqrt1rem) . "\n";
|
||||
echo gmp_strval($sqrt2) . ", " . gmp_strval($sqrt2rem) . "\n";
|
||||
echo gmp_strval($sqrt3) . ", " . gmp_strval($sqrt3rem) . "\n";
|
||||
echo gmp_strval($sqrt1) . ", " . gmp_strval($sqrt1rem) . "\n";
|
||||
echo gmp_strval($sqrt2) . ", " . gmp_strval($sqrt2rem) . "\n";
|
||||
echo gmp_strval($sqrt3) . ", " . gmp_strval($sqrt3rem) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
3, 0
|
||||
2, 3
|
||||
1024, 0
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-strval">
|
||||
<refnamediv>
|
||||
<refname>gmp_strval</refname>
|
||||
<refpurpose>Convert GMP number to string</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>gmp_strval</methodname>
|
||||
<methodparam><type>resource</type><parameter>gmpnumber</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>base</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Convert GMP number to string representation in base
|
||||
<parameter>base</parameter>. The default base is 10. Allowed
|
||||
values for the base are from 2 to 36.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Converting a GMP number to a string</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-strval">
|
||||
<refnamediv>
|
||||
<refname>gmp_strval</refname>
|
||||
<refpurpose>Convert GMP number to string</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>gmp_strval</methodname>
|
||||
<methodparam><type>resource</type><parameter>gmpnumber</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>base</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Convert GMP number to string representation in base
|
||||
<parameter>base</parameter>. The default base is 10. Allowed
|
||||
values for the base are from 2 to 36.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Converting a GMP number to a string</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$a = gmp_init("0x41682179fbf5");
|
||||
printf("Decimal: %s, 36-based: %s", gmp_strval($a), gmp_strval($a,36));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,43 +1,43 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-sub">
|
||||
<refnamediv>
|
||||
<refname>gmp_sub</refname>
|
||||
<refpurpose>Subtract numbers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_sub</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Subtracts <parameter>b</parameter> from <parameter>a</parameter>
|
||||
and returns the result.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_sub</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-sub">
|
||||
<refnamediv>
|
||||
<refname>gmp_sub</refname>
|
||||
<refpurpose>Subtract numbers</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_sub</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Subtracts <parameter>b</parameter> from <parameter>a</parameter>
|
||||
and returns the result.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_sub</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$sub = gmp_sub("281474976710656", "4294967296"); // 2^48 - 2^32
|
||||
echo gmp_strval($sub) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
281470681743360
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/gmp.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.gmp-xor">
|
||||
<refnamediv>
|
||||
<refname>gmp_xor</refname>
|
||||
<refpurpose>Logical XOR</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_xor</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates logical exclusive OR (XOR) of two GMP numbers.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_xor</function> example</title>
|
||||
<programlisting role="php">
|
||||
<refentry id="function.gmp-xor">
|
||||
<refnamediv>
|
||||
<refname>gmp_xor</refname>
|
||||
<refpurpose>Logical XOR</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>gmp_xor</methodname>
|
||||
<methodparam><type>resource</type><parameter>a</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>b</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Calculates logical exclusive OR (XOR) of two GMP numbers.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>gmp_xor</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$xor1 = gmp_init("1101101110011101", 2);
|
||||
|
@ -29,18 +29,18 @@ $xor3 = gmp_xor($xor1, $xor2);
|
|||
echo gmp_strval($xor3, 2) . "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The printout of the above program will be:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
1011110111000100
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
Loading…
Reference in a new issue