2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2003-12-18 10:02:11 +00:00
|
|
|
<!-- $Revision: 1.3 $ -->
|
2002-04-15 00:12:54 +00:00
|
|
|
<!-- splitted from ./en/functions/bc.xml, last change in rev 1.2 -->
|
|
|
|
<refentry id="function.bccomp">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>bccomp</refname>
|
|
|
|
<refpurpose>Compare two arbitrary precision numbers</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>int</type><methodname>bccomp</methodname>
|
|
|
|
<methodparam><type>string</type><parameter>left_operand</parameter></methodparam>
|
|
|
|
<methodparam><type>string</type><parameter>right_operand</parameter></methodparam>
|
|
|
|
<methodparam choice="opt"><type>int</type><parameter>scale</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
Compares the <parameter>left_operand</parameter> to the
|
|
|
|
<parameter>right_operand</parameter> and returns the result as an
|
|
|
|
integer. The optional <parameter>scale</parameter> parameter is
|
|
|
|
used to set the number of digits after the decimal place which
|
|
|
|
will be used in the comparison. The return value is 0 if the two
|
|
|
|
operands are equal. If the <parameter>left_operand</parameter>
|
|
|
|
is larger than the <parameter>right_operand</parameter> the
|
|
|
|
return value is +1 and if the <parameter>left_operand</parameter>
|
|
|
|
is less than the <parameter>right_operand</parameter> the return
|
|
|
|
value is -1.
|
|
|
|
</para>
|
2003-12-18 10:02:11 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>bccomp</function> example</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
echo bccomp('1', '2') . "\n";
|
|
|
|
|
|
|
|
echo bccomp('1.00001', '1', 3) . "\n";
|
|
|
|
echo bccomp('1.00001', '1', 5);
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
<para>
|
|
|
|
The above example will output:
|
|
|
|
</para>
|
|
|
|
<screen>
|
|
|
|
<![CDATA[
|
|
|
|
-1
|
|
|
|
0
|
|
|
|
1
|
|
|
|
]]>
|
|
|
|
</screen>
|
|
|
|
</example>
|
|
|
|
</para>
|
2002-04-15 00:12:54 +00:00
|
|
|
</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
|
|
|
|
-->
|