d3dx9 [patch1/3, try 2]: Do not use relative error for small numbers

Matteo Bruni matteo.mystral at gmail.com
Tue Apr 2 10:54:37 CDT 2013


2013/4/1 Nozomi Kodama <nozomi.kodama at yahoo.com>
>
> Since there are only at most 7 significant digits for a float, we must not be too picky about the expected difference for small numbers
>

> -#define relative_error(exp, out) ((exp == 0.0f) ? fabs(exp - out) : (fabs(1.0f - (out) / (exp))))
> +#define relative_error(exp, out) (fabs(exp) < 0.01f ? fabs(exp - out) : fabs(1.0f - (out) / (exp)))

This doesn't make much sense. Being floating point numbers, they have
the same relative precision regardless of the magnitude of the value
(as long as you are inside the range of representable values and
excluding special values and denormals, but that should be irrelevant
to our case here).
If using a larger tolerance for the test in patch 2 makes it pass,
then I think that's all you have to change. Otherwise you need to
figure out why the test result differs so much from the expected
value.

Slightly unrelated, I think we should use fabsf() instead of fabs()
there. We are already using fabsf() in a bunch of places, including
d3dx9 tests, so there shouldn't be problems with that.



More information about the wine-devel mailing list