php.net |  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:
MUST BE VALID
Solve the problem:
45 - 13 = ?
Subscribe to this entry?

 
 [2017-12-07 15:51 UTC] mcsoftware at alikuvkoutek dot cz
Description:
------------
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:
----------------
200

Actual result:
--------------
100

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] requinix@php.net
-Status: Closed +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 08:01:32 2024 UTC