|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75648 round() does not respect mode when precision is negative
Submitted: 2017-12-07 15:51 UTC Modified: 2017-12-07 16:11 UTC
From: mcsoftware at alikuvkoutek dot cz Assigned:
Status: Not a bug Package: Math related
PHP Version: 7.1.12 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
21 + 20 = ?
Subscribe to this entry?

 [2017-12-07 15:51 UTC] mcsoftware at alikuvkoutek dot cz
Round does not round up when precision is negative even PHP_ROUND_HALF_UP mode is provided.

Test script:
echo round(123, -2, PHP_ROUND_HALF_UP);

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-12-07 15:58 UTC] mcsoftware at alikuvkoutek dot cz
-Status: Open +Status: Closed
 [2017-12-07 15:58 UTC] mcsoftware at alikuvkoutek dot cz
Sorry, I was expecting ceil/floor bevaior and the mode is just for the "half" numbers.
 [2017-12-07 16:11 UTC]
-Status: Closed +Status: Not a bug
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Jul 06 22:01:03 2020 UTC