php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60393 Generating minus-zero with ceil()
Submitted: 2011-11-26 08:29 UTC Modified: 2011-11-26 15:04 UTC
From: athlan at vgroup dot pl Assigned:
Status: Not a bug Package: Math related
PHP Version: 5.3.8 OS: MacOSX Snow Leopard
Private report: No CVE-ID: None
 [2011-11-26 08:29 UTC] 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 ?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-26 15:04 UTC] cataphract@php.net
-Status: Open +Status: Bogus
 [2011-11-26 15:04 UTC] 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 15:05 UTC] anon at anon dot anon
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 02:01:29 2024 UTC