Req #23498 [Com]: ceil() / floor() needs precision option
Edit report at https://bugs.php.net/bug.php?id=23498&edit=1
ID: 23498
Comment by: phpmpan at mpan dot pl
Reported by: junk at factory8 dot com
Summary: ceil() / floor() needs precision option
Status: Open
Type: Feature/Change Request
Package: Math related
Operating System: *
PHP Version: *
Block user comment: N
Private report: N
New Comment:
In the context of bug 64675 and bug 64674 I dig up a 10 years old bug.
Both ceil and floor functions make no sense for floating point numbers
except a small subset of them. This is because either:
- There is no element in the floating point numbers set that matches the result of these functions.
- A relative difference between the result and the input is so small that it's irrelevant.
As per original report: floating point numbers should NEVER be used for financial calculations.
Previous Comments:
------------------------------------------------------------------------
[2003-05-06 11:44:15] michael dot mauch at gmx dot de
$x = 24.203;
echo ceil($x*100)/100,"\n";
Would it be good enough if the manual would hint into that direction?
------------------------------------------------------------------------
[2003-05-05 18:45:28] junk at factory8 dot com
ceil() should have a percision option. This would greatly help in rounding for tax.
Example
it is not easy to round $24.203 to $24.21
Thanks
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=23498&edit=1
Thread (4 messages)