note 83912 added to function.sprintf

From: Date: Wed, 18 Jun 2008 09:19:45 +0000
Subject: note 83912 added to function.sprintf
Groups: php.notes 
Request: Send a blank email to php-notes+get-140558@lists.php.net to get a copy of this message
Rounding seems a little inconsistent, so beware: $ php -a php> print round(1.0*20*1.175/100,2); 0.24 php > print sprintf("%.2f",1.0*20*1.175/100); 0.23 php > print sprintf("%.0f",1.0*20*1.175); 24 I get round this by doing the round first, then doing the sprintf. ---- Server IP: 87.124.64.96 Probable Submitter: 77.96.211.84 ---- Manual Page -- http://www.php.net/manual/en/function.sprintf.php Edit -- https://master.php.net/note/edit/83912 Del: integrated -- https://master.php.net/note/delete/83912/integrated Del: useless -- https://master.php.net/note/delete/83912/useless Del: bad code -- https://master.php.net/note/delete/83912/bad+code Del: spam -- https://master.php.net/note/delete/83912/spam Del: non-english -- https://master.php.net/note/delete/83912/non-english Del: in docs -- https://master.php.net/note/delete/83912/in+docs Del: other reasons-- https://master.php.net/note/delete/83912 Reject -- https://master.php.net/note/reject/83912 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#140558) next »