Doc #77778 [Csd]: 0.0 is falsy but docs do not say -0.0 is falsy too

From: Date: Wed, 27 Mar 2019 23:53:25 +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-16531@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 Updated by: salathe@php.net 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: Thanks for mentioning it, but to what end: do you want the -0 example removed? Previous Comments: ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ [2019-03-21 19:26:17] salathe@php.net Automatic comment from SVN on behalf of salathe Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=347033 Log: negative zero is falsy (fix bug #77778) ------------------------------------------------------------------------ [2019-03-21 19:06:11] requinix@php.net > Sections 7.2 and 6.3 together imply that it is by design that 1/0.0 is INF and 1/-0.0 is -INF. Right. They could have said $n/0.0 == $n/-0.0 == NAN or DIV or something but they chose the arguably more useful +INF/-INF. It also means that according to IEEE +0.0 and -0.0 are treated inconsistently: equal in one place, not equal in another. Anyways, PHP does not distinguish between +0.0 and -0.0 because the IEEE-ness of PHP's floats is besides the point. In fact there have been bugs where PHP produces an unexpected "-0.0" which were fixed so it was "0.0". And everyone agrees that +0.0 === -0.0 should be true. Which is why saying that (bool)-0.0 should be true doesn't make sense - it should be false, as it already is. Which brings this to a question of documentation: whether or not to state that yes, in fact, -0.0 is falsy too. But like I said, an easy enough edit. ------------------------------------------------------------------------ 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

« previous php.doc.bugs (#16531) next »