I've got a big loop going through an array. What I'm seeing is that one 1 certain set of values, an expression like x>y evaluates to true even though x = y. Completely wrong! Here's my code snippet.
Code: Select all
for ($j=0;$j<$totalcount;$j++) {
if (($x[$j] > $ymin) && ($x[$j] <= $ymax)) {
$num++;
}
}This code works great except in one case where $x = 2.982 and $ymin = 2.982. In that case, this equation evaluates to true and $num is increased.
So, I thought maybe had an issue with the logical && (even though it's so simple code), so I added a statement directly above the ymin,ymax code:
Code: Select all
if ($x[$j] > $ymin) {
echo "hello";
}