On 13 August 2015 at 02:23, Bernhard Übelacker bernhardu@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.
On 08/13/15 11:08, Henri Verbeet wrote:
On 13 August 2015 at 02:23, Bernhard Übelacker bernhardu@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.
Please also remove win_skips when _errno, strtof or _strtof_l are not available. The functions are present in all versions of msvcr120. Sorry for not spotting it earlier.
Thanks, Piotr