ID:               36310
 Updated by:       [EMAIL PROTECTED]
 Reported By:      daedalon at users dot sourceforge dot net
 Status:           Open
-Bug Type:         *Math Functions
+Bug Type:         Feature/Change Request
 Operating System: any
 PHP Version:      5.1.2
 New Comment:

Marking as Feature Request.


Previous Comments:
------------------------------------------------------------------------

[2006-02-07 02:05:18] daedalon at users dot sourceforge dot net

Description:
------------
Since PHP 4, round() takes precision as a parameter. This would be very
useful for floor() and ceil() too for there are cases when one wants to
round fractions up or down to certain precision.


By the way the documentation for floor() and ceil() could make a note
of how the functions act for zero decimals to increase clarity.
Currently the behavior could be too easily misinterpreted by someone
non-native English reader.

Reproduce code:
---------------
echo round(5.055, 2);  // Prints 5.06 as expected
echo floor(15.075, 2); // Should print 15,07 but prints 15
echo ceil(3.041, 2);   // Should print 3,05 but prints 4

Expected result:
----------------
echo round(5.055, 2);  // Prints 5.06 as expected
echo floor(15.075, 2); // Should print 15,07 but prints 15
echo ceil(3.041, 2);   // Should print 3,05 but prints 4

Actual result:
--------------
echo round(5.055, 2);  // Prints 5.06 as expected
echo floor(15.075, 2); // Should print 15,07 but prints 15
echo ceil(3.041, 2);   // Should print 3,05 but prints 4


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36310&edit=1

Reply via email to