note 111712 added to function.round

From: Date: Wed, 20 Mar 2013 08:36:40 +0000
Subject: note 111712 added to function.round
Groups: php.notes 
Request: Send a blank email to php-notes+get-194128@lists.php.net to get a copy of this message
NOTE: when you set precision to bigger than 16, the round result will be strange! //PHP 5.2.10 (cli) (built: Jun 22 2009 10:59:16) //Linux S139 2.6.9-67.0.1.ELsmp #1 SMP Wed Dec 19 16:01:12 EST 2007 i686 i686 i386 GNU/Linux //CentOS release 4.6 (Final) ini_set("precision", "50"); echo round(1.0/3.0,2), "\n"; //0.33000000000000001554312234475219156593084335327148 ini_set("precision", "17"); echo round(1.0/3.0,2), "\n";// 0.33000000000000002 ini_set("precision", "17"); echo round(1.0/3.0,1), "\n"; // 0.29999999999999999 ini_set("precision", "16"); echo round(1.0/3.0,2), "\n"; // 0.33 ini_set("precision", "12"); echo round(1.0/3.0,2), "\n"; // 0.33 ---- Server IP: 69.147.83.199 Probable Submitter: 202.134.97.106 ---- Manual Page -- http://php.net/manual/en/function.round.php Edit -- https://master.php.net/note/edit/111712 Del: integrated -- https://master.php.net/note/delete/111712/integrated Del: useless -- https://master.php.net/note/delete/111712/useless Del: bad code -- https://master.php.net/note/delete/111712/bad+code Del: spam -- https://master.php.net/note/delete/111712/spam Del: non-english -- https://master.php.net/note/delete/111712/non-english Del: in docs -- https://master.php.net/note/delete/111712/in+docs Del: other reasons-- https://master.php.net/note/delete/111712 Reject -- https://master.php.net/note/reject/111712 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#194128) next »