Bug #60393 [Com]: Generating minus-zero with ceil()
| From: | anon at anon dot anon | Date: | Sat, 26 Nov 2011 15:05:43 +0000 |
| Subject: | Bug #60393 [Com]: Generating minus-zero with ceil() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165511@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60393&edit=1
ID: 60393
Comment by: anon at anon dot anon
Reported by: athlan at vgroup dot pl
Summary: Generating minus-zero with ceil()
Status: Bogus
Type: Bug
Package: Math related
Operating System: MacOSX Snow Leopard
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
That's correct. Like virtually all modern languages and CPUs, PHP implements the representation
and behavior of floating-point numbers according to the standard "IEEE 754". Negative zero
is a feature of that standard: http://en.wikipedia.org/wiki/Signed_zero
Previous Comments:
------------------------------------------------------------------------
[2011-11-26 15:04:07] cataphract@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
IEEE 754-2008, definition 2.1.25: (...) All floating-point numbers, including zeros and infinities,
are signed.
------------------------------------------------------------------------
[2011-11-26 08:29:34] athlan at vgroup dot pl
Description:
------------
---
From manual page: http://www.php.net/function.ceil#refsect1-function.ceil-unknown
---
You can generate a minus-zero, which is invalid number:
<?php echo ceil(-0.3); ?>
Test script:
---------------
<?php echo ceil(-0.3); ?>
Expected result:
----------------
<?php echo ceil(-0.3); // should return 0, not -0 ?>
Actual result:
--------------
<?php echo ceil(-0.3); // returns -0 ?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60393&edit=1