Bug #17726 Updated: Serious comparision operator bug using floating point vars
| From: | derick@php.net | Date: | Wed, 12 Jun 2002 13:54:54 +0000 |
| Subject: | Bug #17726 Updated: Serious comparision operator bug using floating point vars | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-10243@lists.php.net to get a copy of this message | ||
ID: 17726
Updated by: derick@php.net
Reported By: Snelders@Infocure.nl
-Status: Open
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Redhat kernel 2.2.19-7.0.12
PHP Version: 4.2.1
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Search the archives... and see:
http://www.php.net/manual/en/language.types.float.php
Previous Comments:
------------------------------------------------------------------------
[2002-06-12 09:53:32] Snelders@Infocure.nl
--- My code ---
<?
$HRDelta = 1;
function HRValue($Max = 100){
global $HRDelta;
$C = ($Max < 0 ? -1 : 1);
$Order = floor(log10($Max * $C));
$i = 1;
do{
$AxisMax = $i * $HRDelta * pow(10,$Order);
$i++;
}while($Max * $C >= $AxisMax);
echo "Expression: (\$Max * \$C >= \$AxisMax) ? \"true\" :
\"false\")<BR>\n";
echo "Evaluated: (" . $Max * $C . " >= $AxisMax) ? \"true\" :
\"false\")<BR>\n";
echo "Answer: " . (($Max * $C >= $AxisMax) ? "true" : "false") .
"<BR>";
return $C * $AxisMax;
}
echo HRValue(-0.7);
?>
--- My Output ---
Expression: ($Max * $C >= $AxisMax) ? "true" : "false")
Evaluated: (0.7 >= 0.7) ? "true" : "false")
Answer: false
-0.7
--- Description problem ---
The last comparison operator returns false for some unknown reason. I
also checked the variables using var_dump and they seem to be exactly
the same (float(0.7)) according to php.
--- My configure line --
'./configure' '--with-apxs=/usr/sbin/apxs' '--with-mysql=/usr/'
'--with-png-dir=/usr/local/libpng' '--with-gd=/usr/local/gd-1.8.4'
'--with-zlib' '--with-ttf' '--with-freetype-dir=/usr/local/freetype2'
'--with-xml' '--with-oracle=/users/home/oskarsson/OraHome1'
'--with-oci8=/users/home/oskarsson/OraHome1'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17726&edit=1