note 109380 added to function.round

From: Date: Thu, 12 Jul 2012 11:16:43 +0000
Subject: note 109380 added to function.round
Groups: php.notes 
Request: Send a blank email to php-notes+get-189108@lists.php.net to get a copy of this message
round() will sometimes return E notation when rounding a float when the amount is small enough - see https://bugs.php.net/bug.php?id=44223 . Apparently it's a feature. To work around this "feature" when converting to a string, surround your round statement with an sprintf: sprintf("%.10f", round( $amountToBeRounded, 10)); ---- Server IP: 69.147.83.197 Probable Submitter: 77.103.186.175 ---- Manual Page -- http://www.php.net/manual/en/function.round.php Edit -- https://master.php.net/note/edit/109380 Del: integrated -- https://master.php.net/note/delete/109380/integrated Del: useless -- https://master.php.net/note/delete/109380/useless Del: bad code -- https://master.php.net/note/delete/109380/bad+code Del: spam -- https://master.php.net/note/delete/109380/spam Del: non-english -- https://master.php.net/note/delete/109380/non-english Del: in docs -- https://master.php.net/note/delete/109380/in+docs Del: other reasons-- https://master.php.net/note/delete/109380 Reject -- https://master.php.net/note/reject/109380 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#189108) next »