note 83912 deleted from function.sprintf by cmb
| From: | cmb@php.net | Date: | Sun, 02 Dec 2018 12:57:52 +0000 |
| Subject: | note 83912 deleted from function.sprintf by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209833@lists.php.net to get a copy of this message | ||
Note Submitter: ant at loadtrax dot com
----
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.