[PATCH] msvcr120: Implement strtof and _strtof_l (try 2)

Henri Verbeet hverbeet at gmail.com
Thu Aug 13 04:08:49 CDT 2015


On 13 August 2015 at 02:23, Bernhard Übelacker <bernhardu at 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.



More information about the wine-devel mailing list