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
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: mcsoftware at alikuvkoutek dot cz
New email:
PHP Version: OS:

 

 [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-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 30 15:01:27 2020 UTC