#42477 [Opn->Bgs]: round() returns negative zero
| From: | jani@php.net | Date: | Wed, 29 Aug 2007 20:24:38 +0000 |
| Subject: | #42477 [Opn->Bgs]: round() returns negative zero | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-116838@lists.php.net to get a copy of this message | ||
ID: 42477
Updated by: jani@php.net
Reported By: koen at genericmedia dot nl
-Status: Open
+Status: Bogus
Bug Type: Math related
Operating System: Windows XP
PHP Version: 5.2.3
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2007-08-29 19:57:10] 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)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42477&edit=1