php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42477 round() returns negative zero
Submitted: 2007-08-29 19:57 UTC Modified: 2007-08-29 20:24 UTC
From: koen at genericmedia dot nl Assigned:
Status: Not a bug Package: Math related
PHP Version: 5.2.3 OS: Windows XP
Private report: No CVE-ID: None
 [2007-08-29 19:57 UTC] koen at genericmedia dot nl
Description:
------------
When rounding a small negative number, the function returns a negative zero. I suspect this has something to do with computing precision, so I suppose that the reason is not really a bug. I've seen the bug report at #31870 and I understand the answer. Strange thing is however that prior to 5.2.3 the result actually was float(0).

Reproduce code:
---------------
<?php
  var_dump( round(-0.26) );
?>

Expected result:
----------------
float(0)

Actual result:
--------------
PHP 4.3.10:
float(0)

PHP 4.4.6:
float(0)

PHP 5.1.6:
float(0)

PHP 5.2.3:
float(-0)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-29 20:24 UTC] jani@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Nov 27 12:01:28 2024 UTC