compare double value to 0 - unreliable comparisons warning
Hey - Quick one for ya...
I get the warning message below at compile time because i'm trying to compare a double value to 0.
What should I use to compare it? I'm working on a matrix multiplier so thought a cast would be a slow, if not accuracy losing method of doing it.
Quote:
warning #1572: floating-point equality and inequality comparisons are unreliable
Code:
double alpha;
...
if ((m == 0) || (n == 0) || (((alpha == 0) || (k == 0)) && (beta == 1)))
Elementary stuff no doubt but in my defence it's getting late....
Thanks,
Colly.