note 85466 added to function.round

From: Date: Mon, 01 Sep 2008 12:05:51 +0000
Subject: note 85466 added to function.round
Groups: php.notes 
Request: Send a blank email to php-notes+get-144049@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/85466 Del: integrated -- https://master.php.net/note/delete/85466/integrated Del: useless -- https://master.php.net/note/delete/85466/useless Del: bad code -- https://master.php.net/note/delete/85466/bad+code Del: spam -- https://master.php.net/note/delete/85466/spam Del: non-english -- https://master.php.net/note/delete/85466/non-english Del: in docs -- https://master.php.net/note/delete/85466/in+docs Del: other reasons-- https://master.php.net/note/delete/85466 Reject -- https://master.php.net/note/reject/85466 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#144049) next »