note 111712 deleted from function.round by aharvey

From: Date: Wed, 20 Mar 2013 18:50:39 +0000
Subject: note 111712 deleted from function.round by aharvey
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-194142@lists.php.net to get a copy of this message
Note Submitter: gu dot zhichao at yahoo dot com dot cn ---- 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

« previous php.notes (#194142) next »