I'm not sure, but I suspect this is because of 80-bit intermediary float
point operation result. Its precision too excessive and gives us this
inexpectible result. But when you use an intermediary variable this
exessive intermediary result is rounded properly and you get what you
expect. See here - http://d.puremagic.com/issues/show_bug.cgi?id=6531.
The reason is:
float a, b, c, d, foo;
foo = a + b / c;
if (d < foo) { // you compare two float value
} else {
}
but:
if (d < (a + b / c)) { // you compare float value and 80bit value and
sometimes the result won't be what you expected
} else {
}
in your case in release mode compiler may do some optimization and do
not round value properly but using temp you force do proper rounding