note 85465 added to function.round

From: Date: Mon, 01 Sep 2008 12:05:38 +0000
Subject: note 85465 added to function.round
Groups: php.notes 
Request: Send a blank email to php-notes+get-144048@lists.php.net to get a copy of this message
I dont think it is a bug as such but when rounding genrally you tend to only round from the digit after the precision you want. The only way to get arround this is by rounding it twice with diffrent precisions: <?php $round1 = round(8.1246, 3); //8.125 $round2 = round($round1, 2); //8.13 echo $round2; ?> ---- Server IP: 92.48.100.16 Probable Submitter: 92.233.104.237 ---- Manual Page -- http://www.php.net/manual/en/function.round.php Edit -- https://master.php.net/note/edit/85465 Del: integrated -- https://master.php.net/note/delete/85465/integrated Del: useless -- https://master.php.net/note/delete/85465/useless Del: bad code -- https://master.php.net/note/delete/85465/bad+code Del: spam -- https://master.php.net/note/delete/85465/spam Del: non-english -- https://master.php.net/note/delete/85465/non-english Del: in docs -- https://master.php.net/note/delete/85465/in+docs Del: other reasons-- https://master.php.net/note/delete/85465 Reject -- https://master.php.net/note/reject/85465 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#144048) next »