|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-09-18 05:44 UTC] roy dot name at gmail dot com
Description:
------------
Why the (9.8*3 != 29.4)
see the code may know clear
Reproduce code:
---------------
<?php
$test = 9.8;
if ( $test*3 == 29.4 ) {
echo 'True';
} else {
echo 'False'; # This is the out?
}
# If the value of $test is many others value ,and '29.4' is
# the correct value,the program will out the True;
?>
Expected result:
----------------
Expected result:True
Actual result:
--------------
Actual result:
False
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 19:00:01 2025 UTC |
<?php $test = 12.4; if ( $test*3 == 37.2 ) { echo 'True'; } else { echo 'False'; # This is the out? } ?> If I change the Floating point values,for example:12.4,then,the result is 37.2,and it can output the actual result