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
 [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: Sat Jul 27 01:01:30 2024 UTC