I found that some straightforward code results in an unexpected (and incorrect) inequality comparison on GCC 4.6.1 vs Visual Studio (2008 & 2012) or Clang 7.3.0 on OSX.
Here's a reduced snippet:
typedef float ftype;
struct Foo
{
ftype v;
Foo(): v(16.0f / 60.0f) {}
ftype val() const {return v * 60.0f;}
};
void bar()
{
Foo f;
ftype v = f.val();
if (v != f.val())
printf("inequal");
}
If ftype is typedef'd as double then the problem doesn't occur. Could this be something to do with compiler inlining? Perhaps actually returning a double instead of a float?