note 91037 added to function.ceil
| From: | stevekirkby at gmail dot com | Date: | Thu, 21 May 2009 23:11:53 +0000 |
| Subject: | note 91037 added to function.ceil | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-155859@lists.php.net to get a copy of this message | ||
Hi
I've always used coxswain's solution if it's a one off calculation. e.g.
To CEIL/FLOOR to 3 decimal places, multiply the value by 1000, apply the CEIL/FLOOR function and
then divide by 1000. 2dp would be 100, 5 dp would be 100000
eg a value of 4.827364237 multiplied by 1000 becomes 4827.364237 which when 'FLOOR'ed
equals 4827, and divided by 1000 equals 4.827
$value = CEIL($value*1000)/1000;
$value = FLOOR($value*1000)/1000;
Steve
----
Server IP: 92.48.74.199
Probable Submitter: 80.225.68.35
----
Manual Page -- http://www.php.net/manual/en/function.ceil.php
Edit -- https://master.php.net/note/edit/91037
Del: integrated -- https://master.php.net/note/delete/91037/integrated
Del: useless -- https://master.php.net/note/delete/91037/useless
Del: bad code -- https://master.php.net/note/delete/91037/bad+code
Del: spam -- https://master.php.net/note/delete/91037/spam
Del: non-english -- https://master.php.net/note/delete/91037/non-english
Del: in docs -- https://master.php.net/note/delete/91037/in+docs
Del: other reasons-- https://master.php.net/note/delete/91037
Reject -- https://master.php.net/note/reject/91037
Search -- https://master.php.net/manage/user-notes.php