13 Aug
2015
13 Aug
'15
9:08 a.m.
On 13 August 2015 at 02:23, Bernhard Übelacker <bernhardu(a)vr-web.de> wrote:
+static inline BOOL almost_equal(float d1, float d2) { + if(d1-d2>-1e-30 && d1-d2<1e-30) + return TRUE; + return FALSE; +} + You almost never want to compare floating point values like that. See e.g. compare_float() in dlls/ddraw/tests/ddraw7.c for a better (if perhaps not quite perfect) way. E.g. for the FLT_MAX case this only works because you happen to get an exact match. "1e-30" is a double instead of a float. Of course this is probably copied from the existing tests, so I suppose I can't complain too much.