B
Ben Bacarisse
[email protected] said:Thanks everyone for your comments. Here is some code that tries to
explain the problem?
Sorry to join in the throng, but the problem was clear. The request
for real code was so that people here might have a stab at determining
the cause. The sketch below has too many gaps to help identify any
cause. One thing stands out for me, though...
somefloatVal = Method2(MyArray1[Att], MyArray2[Att]);
if (somefloatVal == someothervale)
{
//do something
}
What type is "someothervale" [sic]? If it, too, is a floating type,
you have a serious problem. Testing floating-point values for
equality is almost always wrong. This program can print "what?" (in
fact it almost always will!):
int main(void)
{
float a = 7.0/3;
if (a == 7.0/3)
puts("OK");
else puts("what?");
return 0;
}