php-doc-en/reference/gmp/functions/gmp-sqrtrem.xml
2004-02-26 11:14:11 +00:00

71 lines
1.9 KiB
XML

<?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">
<![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";
?>
]]>
</programlisting>
<para>
The printout of the above program will be:
</para>
<screen>
<![CDATA[
3, 0
2, 3
1024, 0
]]>
</screen>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->