Doc #77778 [Csd]: 0.0 is falsy but docs do not say -0.0 is falsy too
| From: | lewisje at alumni dot iu dot edu | Date: | Thu, 04 Apr 2019 08:38:40 +0000 |
| Subject: | Doc #77778 [Csd]: 0.0 is falsy but docs do not say -0.0 is falsy too | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16548@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77778&edit=1
ID: 77778
User updated by: lewisje at alumni dot iu dot edu
Reported by: lewisje at alumni dot iu dot edu
Summary: 0.0 is falsy but docs do not say -0.0 is falsy too
Status: Closed
Type: Documentation Problem
Package: *General Issues
Operating System: CentOS 6
PHP Version: Irrelevant
Assigned To: salathe
Block user comment: N
Private report: N
New Comment:
Sorry, that code example was supposed to be this:
<?php
var_dump(empty(-0.0)); // bool(true)
?>
Previous Comments:
------------------------------------------------------------------------
[2019-04-04 08:37:38] lewisje at alumni dot iu dot edu
Yes, because there is not an integer -0 that is distinct from the integer 0; also, I don't know
whether this is out of scope for the bug, but https://php.net/function.empty does not mention that the
float -0.0 is treated as empty, even though it is:
<?php
var_dump(-0.0); // bool(true)
?>
------------------------------------------------------------------------
[2019-03-27 23:53:25] salathe@php.net
Thanks for mentioning it, but to what end: do you want the -0 example removed?
------------------------------------------------------------------------
[2019-03-27 23:40:02] lewisje at alumni dot iu dot edu
I just saw the new documentation page, and I should mention that there is no distinction between -0
and 0 for *integer* arithmetic, even though floating-point makes such a distinction:
<?php
var_dump(1/-0); // float(INF)
var_dump(1/0); // float(INF)
?>
------------------------------------------------------------------------
[2019-03-21 19:30:46] salathe@php.net
Automatic comment on behalf of salathe
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=096a3dce5d92652947579249761728eb4e48cdde
Log: negative zero is falsy (fix bug #77778)
------------------------------------------------------------------------
[2019-03-21 19:26:46] salathe@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=77778
--
Edit this bug report at https://bugs.php.net/bug.php?id=77778&edit=1