php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #25689 RFE for: ceil() floor() functions
Submitted: 2003-09-29 09:27 UTC Modified: 2010-11-19 01:09 UTC
Votes:1
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: php at pgregg dot com Assigned: jani (profile)
Status: Closed Package: Math related
PHP Version: * OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at pgregg dot com
New email:
PHP Version: OS:

 

 [2003-09-29 09:27 UTC] php at pgregg dot com
Description:
------------
RFE: modify ceil/floor functions so that they take a second optional argument (default 1) that is the factor to which the number is rounded up or down?  e.g. you want to round up to the nearest 50?  $x = ceil($y, 50);
currently you'd have to do: $x = intval(($y+49)/50)*50;

This would retain backward compatibility with all code as the default value of 1 would mean that behaviour was the same.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-06 23:06 UTC] tuxedobob at mac dot com
Agreed, but...

It would be nice if ceil() and floor() had a precision 
parameter similar to that of round(), such that:

floor(3.14159, 2) = 3.14
ceil(3.14159, 2)  = 3.15
 [2010-11-18 23:38 UTC] jani@php.net
-Package: Feature/Change Request +Package: Math related -Operating System: All +Operating System: * -PHP Version: Irrelevant +PHP Version: *
 [2010-11-19 01:09 UTC] jani@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: jani
 [2010-11-19 01:09 UTC] jani@php.net
Same as bug #23498
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Dec 06 11:05:52 2022 UTC