diff --git a/dlls/d3dx9_36/tests/math.c b/dlls/d3dx9_36/tests/math.c index 56754769ab5..1e10b1fc9b0 100644 --- a/dlls/d3dx9_36/tests/math.c +++ b/dlls/d3dx9_36/tests/math.c @@ -3294,23 +3294,29 @@ static void test_D3DXSHMultiply3(void) static void test_D3DXSHMultiply4(void) { + float a[20], b[20], c[20]; unsigned int i; - FLOAT a[20], b[20], c[20]; - /* D3DXSHMultiply4 only modifies the first 16 elements of the array */ - const FLOAT expected[] = - { /* c, a, b */ - 14.182599f, 2.615703f, 12.828601f, 9.820596f, 3.039696f, 4.530442f, - 5.820584f, 12.249846f, 2.194346f, 3.900152f, 5.416609f, 5.601813f, - 0.959982f, 7.037550f, 3.625230f, 0.463601f, 16.0f, 17.0f, 18.0f, 19.0f, - /* c, c, b */ - -211441.265625f, -2529.157715f, -10023.393555f, -441.277191f, -163.994385f, - -526.305115f, 29636.187500f, -3931.830811f, -13577.111328f, -3978.973877f, - -10330.341797f, -13779.787109f, -16685.109375f, -44981.375000f, -73269.742188f, - -95237.335938f, 16.0f, 17.0f, 18.0f, 19.0f, - /* c, c, c */ - 0.236682f, -0.717649f, -0.180500f, -0.077124f, 0.144831f, 0.573286f, - -0.337959f, 0.055694f, -0.442100f, 0.147702f, -0.055157f, 0.084337f, - 0.179877f, 0.009099f, 0.232200f, 0.074142f, 1.6f, 1.7f, 1.8f, 1.9f, }; + BOOL equal; + + /* D3DXSHMultiply4() only modifies the first 16 elements of the array. */ + static const float expected[] = + { + /* c, a, b */ + 1.41825991e+01f, 2.61570334e+00f, 1.28286009e+01f, 9.82059574e+00f, 3.03969646e+00f, 4.53044176e+00f, + 5.82058382e+00f, 1.22498465e+01f, 2.19434643e+00f, 3.90015244e+00f, 5.41660881e+00f, 5.60181284e+00f, + 9.59981740e-01f, 7.03754997e+00f, 3.62523031e+00f, 4.63601470e-01f, 1.60000000e+01f, 1.70000000e+01f, + 1.80000000e+01f, 1.90000000e+01f, + /* c, c, b */ + -2.11441266e+05f, -2.52915771e+03f, -1.00233936e+04f, -4.41277191e+02f, -1.63994385e+02f, -5.26305115e+02f, + 2.96361875e+04f, -3.93183081e+03f, -1.35771113e+04f, -3.97897388e+03f, -1.03303418e+04f, -1.37797871e+04f, + -1.66851094e+04f, -4.49813750e+04f, -7.32697422e+04f, -9.52373359e+04f, 1.60000000e+01f, 1.70000000e+01f, + 1.80000000e+01f, 1.90000000e+01f, + /* c, c, c */ + 2.36682415e-01f, -7.17648506e-01f, -1.80499524e-01f, -7.71235973e-02f, 1.44830629e-01f, 5.73285699e-01f, + -3.37959230e-01f, 5.56938872e-02f, -4.42100227e-01f, 1.47701755e-01f, -5.51566519e-02f, 8.43374059e-02f, + 1.79876596e-01f, 9.09878965e-03f, 2.32199892e-01f, 7.41420984e-02f, 1.60000002e+00f, 1.70000005e+00f, + 1.80000007e+00f, 1.89999998e+00f, + }; for (i = 0; i < 20; i++) { @@ -3321,7 +3327,10 @@ static void test_D3DXSHMultiply4(void) D3DXSHMultiply4(c, a, b); for (i = 0; i < 20; i++) - ok(relative_error(c[i], expected[i]) < admitted_error, "Expected[%d] = %f, received = %f\n", i, expected[i], c[i]); + { + equal = compare_float(c[i], expected[i], 16); + ok(equal, "Expected[%u] = %.8e, received = %.8e.\n", i, expected[i], c[i]); + } for (i = 0; i < 20; i++) { @@ -3331,14 +3340,20 @@ static void test_D3DXSHMultiply4(void) D3DXSHMultiply4(c, c, b); for (i = 0; i < 20; i++) - ok(relative_error(c[i], expected[20 + i]) < admitted_error, "Expected[%d] = %f, received = %f\n", i, expected[20 + i], c[i]); + { + equal = compare_float(c[i], expected[20 + i], 32); + ok(equal, "Expected[%u] = %.8e, received = %.8e.\n", i, expected[20 + i], c[i]); + } for (i = 0; i < 20; i++) c[i] = 0.1f * i; D3DXSHMultiply4(c, c, c); for (i = 0; i < 20; i++) - ok(relative_error(c[i], expected[40 + i]) < admitted_error, "Expected[%d] = %f, received = %f\n", i, expected[40 + i], c[i]); + { + equal = compare_float(c[i], expected[40 + i], 8); + ok(equal, "Expected[%u] = %.8e, received = %.8e.\n", i, expected[40 + i], c[i]); + } } static void test_D3DXSHRotate(void)