new structure and constants extra

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@81330 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Friedhelm Betz 2002-05-06 10:56:21 +00:00
parent 2fd00d8b97
commit ba772405e7
2 changed files with 151 additions and 51 deletions

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<section id="xxx.constants">
&reftitle.constants;
&extension.constants;
<variablelist>
<varlistentry>
<term>
<constant>GMP_ROUND_ZERO</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GMP_ROUND_PLUSINF</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>GMP_ROUND_MINUSINF</constant>
(<link linkend="language.types.integer">integer</link>)
</term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
</variablelist>
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -1,56 +1,83 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<reference id="ref.gmp">
<title>GMP functions</title>
<titleabbrev>GMP</titleabbrev>
<partintro>
<simpara>
These functions allow you to work with arbitrary-length integers
using the GNU <acronym>MP</acronym> library. In order to have these
functions available, you must compile PHP with
<acronym>GMP</acronym> support by using the <option
role="configure">--with-gmp</option> option.
</simpara>
<simpara>
You can download the <acronym>GMP</acronym> library from <ulink
url="&url.gmp;">&url.gmp;</ulink>. This site also has the
<acronym>GMP</acronym> manual available.
</simpara>
<simpara>
You will need GMP version 2 or better to use these functions. Some
functions may require more recent version of the GMP library.
</simpara>
<simpara>
These functions have been added in PHP 4.0.4.
</simpara>
<note>
<para>
Most GMP functions accept GMP number arguments, defined as
<literal>resource</literal> below. However, most of these
functions will also accept numeric and string arguments, given
that it is possible to convert the latter to a number. Also,
if there is a faster function that can operate on integer arguments,
it would be used instead of the slower function when the supplied arguments are
integers. This is done transparently, so the bottom line is that
you can use integers in every function that expects GMP
number. See also the <function>gmp_init</function> function.
</para>
</note>
<warning>
<section id="gmp.intro">
&reftitle.intro;
<simpara>
If you want to explicitly specify a large integer,
specify it as a string. If you don't do that, PHP will
interpret the integer-literal first, possibly resulting
in loss of precision, even before <literal>GMP</literal>
comes into play.
These functions allow you to work with arbitrary-length integers
using the GNU <acronym>MP</acronym> library.
</simpara>
</warning>
<para>
<example>
<title>Factorial function using GMP</title>
<programlisting role="php">
<simpara>
These functions have been added in PHP 4.0.4.
</simpara>
<note>
<para>
Most GMP functions accept GMP number arguments, defined as
<literal>resource</literal> below. However, most of these
functions will also accept numeric and string arguments, given
that it is possible to convert the latter to a number. Also,
if there is a faster function that can operate on integer arguments,
it would be used instead of the slower function when the supplied arguments are
integers. This is done transparently, so the bottom line is that
you can use integers in every function that expects GMP
number. See also the <function>gmp_init</function> function.
</para>
</note>
<warning>
<simpara>
If you want to explicitly specify a large integer,
specify it as a string. If you don't do that, PHP will
interpret the integer-literal first, possibly resulting
in loss of precision, even before <literal>GMP</literal>
comes into play.
</simpara>
</warning>
</section>
<section id="gmp.requirenments">
&reftitle.required;
<para>
You can download the <acronym>GMP</acronym> library from <ulink
url="&url.gmp;">&url.gmp;</ulink>. This site also has the
<acronym>GMP</acronym> manual available.
</para>
<simpara>
You will need GMP version 2 or better to use these functions. Some
functions may require more recent version of the GMP library.
</simpara>
</section>
<section id="gmp.installation">
&reftitle.install;
<para>
In order to have these functions available, you must compile PHP with
<acronym>GMP</acronym> support by using the <option
role="configure">--with-gmp</option> option.
</para>
</section>
<section id="gmp.configuration">
&reftitle.runtime;
&no.config;
</section>
<section id="gmp.resources">
&reftitle.resources;
&no.resource;
</section>
&reference.gmp.constants;
<section id="gmp.examples">
&reftitle.examples;
<para>
<example>
<title>Factorial function using GMP</title>
<programlisting role="php">
<![CDATA[
<?php
function fact ($x) {
@ -63,13 +90,24 @@ function fact ($x) {
print gmp_strval (fact (1000)) . "\n";
?>
]]>
</programlisting>
</programlisting>
</example>
</para>
<para>
This will calculate factorial of 1000 (pretty big number)
very fast.
</para>
</para>
<para>
This will calculate factorial of 1000 (pretty big number)
very fast.
</para>
</section>
<section id="gmp.seealso">
&reftitle.seealso;
<para>
More mathmatical functions can be found in the sections
<link linkend="ref.bc">BCMath Arbitrary Precision Mathematics Functions</link>
and <link linkend="ref.math">Mathematical Functions</link>.
</para>
</section>
</partintro>
&reference.gmp.functions;