|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-05-19 02:55 UTC] requinix@php.net
-Status: Open
+Status: Wont fix
[2016-05-19 02:55 UTC] requinix@php.net
[2016-05-19 06:14 UTC] pajoye@php.net
-Status: Wont fix
+Status: Not a bug
[2016-05-19 06:14 UTC] pajoye@php.net
[2016-05-19 13:54 UTC] dosergio at gmail dot com
[2016-05-19 14:23 UTC] dosergio at gmail dot com
[2016-05-19 14:37 UTC] dosergio at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 11:00:02 2026 UTC |
Description: ------------ Zero is zero, I think there is no "float flavour" of zero and "int flavour" of zero since zero is nothing. Why to check data type when both sides are absolute ZERO ? So for the comparison 0 === 0.0, I think PHP should go beyound the memory/way of storing the number, and consider that we are comparing two absolute zero values, so the result could be TRUE as it is in other languages. The data type check only makes sense to enter in scene when one of the compared values differ from zero! What makes a factual float? One number like 0.0000000000001 ! I mean, different from zero. The problem: A programmer knows that a value in some condition is zero. But when comparing if ($myValue === 0) causes failure, since PHP obliges you to write if ($myValue === 0.0) Test script: --------------- $x = floatVal(0); if( $x === 0){ // why to check data type when both sides are ZERO ? echo 'Will not enter here, php expects 0.0'; } else { echo '0 and 0.0 is the same "VALUE"'; }