note 115007 added to function.floor
| From: | josoort at home dot nl | Date: | Mon, 12 May 2014 07:08:19 +0000 |
| Subject: | note 115007 added to function.floor | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199516@lists.php.net to get a copy of this message | ||
You can simply make a floor with decimals function by using the round() function and subtract 0.05
to the value if the value must have 1 decimal accuracy, or 0.005 for 2 decimals accuracy, or 0.0005
for 3 decimals etc.
Example :
function floorDec($input, $decimals)
{
return round($input - (5 / pow(10, $decimals + 1)), $decimals);
}
----
Server IP: 83.137.20.135
Probable Submitter: 84.27.186.179
----
Manual Page -- http://php.net/manual/en/function.floor.php
Edit -- https://master.php.net/note/edit/115007
Del: integrated -- https://master.php.net/note/delete/115007/integrated
Del: useless -- https://master.php.net/note/delete/115007/useless
Del: bad code -- https://master.php.net/note/delete/115007/bad+code
Del: spam -- https://master.php.net/note/delete/115007/spam
Del: non-english -- https://master.php.net/note/delete/115007/non-english
Del: in docs -- https://master.php.net/note/delete/115007/in+docs
Del: other reasons-- https://master.php.net/note/delete/115007
Reject -- https://master.php.net/note/reject/115007
Search -- https://master.php.net/manage/user-notes.php