cvs: phpdoc-pl /reference/math/functions round.xml

From: Date: Tue, 18 Apr 2006 07:58:15 +0000
Subject: cvs: phpdoc-pl /reference/math/functions round.xml
Groups: php.doc.pl 
Request: Send a blank email to doc-pl+get-885@lists.php.net to get a copy of this message
leszek Tue Apr 18 07:58:15 2006 UTC Modified files: /phpdoc-pl/reference/math/functions round.xml Log: [leszek] - updated to EN 1.9 http://cvs.php.net/viewcvs.cgi/phpdoc-pl/reference/math/functions/round.xml?r1=1.6&r2=1.7&diff_format=u Index: phpdoc-pl/reference/math/functions/round.xml diff -u phpdoc-pl/reference/math/functions/round.xml:1.6 phpdoc-pl/reference/math/functions/round.xml:1.7 --- phpdoc-pl/reference/math/functions/round.xml:1.6 Thu Jun 20 01:44:25 2002 +++ phpdoc-pl/reference/math/functions/round.xml Tue Apr 18 07:58:15 2006 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-2"?> -<!-- EN-Revision: 1.3 Maintainer: qrak Status: ready --> -<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.9 Maintainer: qrak Status: ready --> +<!-- $Revision: 1.7 $ --> <refentry id="function.round"> <refnamediv> <refname>round</refname> @@ -20,37 +20,62 @@ zero (domy¶lnie). </para> <para> + <example> + <title>Przyk³ady u¿ycia <function>round</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +echo round(3.4); // 3 +echo round(3.5); // 4 +echo round(3.6); // 4 +echo round(3.6, 0); // 4 +echo round(1.95583, 2); // 1.96 +echo round(1241757, -3); // 1242000 +echo round(5.045, 2); // 5.05 +echo round(5.055, 2); // 5.06 +?> +]]> + </programlisting> + </example> + </para> + <!-- It's not true + <para> <caution> <simpara> + When rounding on exact halves <function>round</function> rounds down on + evens and up on odds. If you want to always force it in one direction + on a .5 (or .05 in your case) add or substract a tiny fuzz factor. The + reason behind rounding half the values down and the other half up is to + avoid the classical banking problem where if you always rounded down + you would be stealing money from your customers, or if you always + rounded up you would end up over time losing money. By averaging it + out through evens and odds you statistically break even. + </simpara> + </caution> + </para> + --> + <para> + <note> + <simpara> PHP domy¶lnie nie obs³uguje poprawnie ³añcuchów znaków takich jak <literal>"12,300.2"</literal>. Zobacz <link linkend="language.types.string.conversion">konwersje z ³añcuchów znaków </link>. </simpara> - </caution> + </note> </para> <para> - <informalexample> - <programlisting role="php"> -<![CDATA[ -echo round(3.4); // 3 -echo round(3.5); // 4 -echo round(3.6); // 4 -echo round(3.6, 0); // 4 -echo round(1.95583, 2); // 1.96 -echo round(1241757, -3); // 1242000 -]]> - </programlisting> - </informalexample> + <note> + <simpara> + Argument <parameter>dok³adno¶æ</parameter> zosta³ dodany w PHP 4. + </simpara> + </note> </para> - <note> - <simpara> - Argument <parameter>dok³adno¶æ</parameter> jest dostêpny tylko w PHP 4. - </simpara> - </note> <simpara> - Patrz tak¿e: <function>ceil</function> i - <function>floor</function>. + Patrz tak¿e: + <function>ceil</function>, + <function>floor</function> i + <function>number_format</function>. </simpara> </refsect1> </refentry>

« previous php.doc.pl (#885) next »