64bits MSVCRT's exp2f(-inf) returns -inf instead of 0.  Tested with
MSVC 2013's CRT.  (I haven't tried 2015 yet.)

Also this does not happen with MinGW.
---
 src/gallium/drivers/llvmpipe/lp_test_arit.c | 38 ++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c 
b/src/gallium/drivers/llvmpipe/lp_test_arit.c
index f3ba5a1..f0582ff 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_arit.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c
@@ -108,6 +108,28 @@ static float sgnf(float x)
 }
 
 
+const float sgn_values[] = {
+   -INFINITY,
+   -60,
+   -4,
+   -2,
+   -1,
+   -1e-007,
+   0,
+   1e-007,
+   0.01,
+   0.1,
+   0.9,
+   0.99,
+   1,
+   2,
+   4,
+   60,
+   INFINITY,
+   NAN
+};
+
+
 const float exp2_values[] = {
    -INFINITY,
    -60,
@@ -273,9 +295,10 @@ const float fract_values[] = {
 
 static const struct unary_test_t
 unary_tests[] = {
-   {"abs", &lp_build_abs, &fabsf, exp2_values, Elements(exp2_values), 20.0 },
-   {"neg", &lp_build_negate, &negf, exp2_values, Elements(exp2_values), 20.0 },
-   {"exp2", &lp_build_exp2, &exp2f, exp2_values, Elements(exp2_values), 20.0 },
+   {"abs", &lp_build_abs, &fabsf, sgn_values, Elements(sgn_values), 20.0 },
+   {"neg", &lp_build_negate, &negf, sgn_values, Elements(sgn_values), 20.0 },
+   {"sgn", &lp_build_sgn, &sgnf, sgn_values, Elements(sgn_values), 20.0 },
+   {"exp2", &lp_build_exp2, &exp2f, exp2_values, Elements(exp2_values), 18.0 },
    {"log2", &lp_build_log2_safe, &log2f, log2_values, Elements(log2_values), 
20.0 },
    {"exp", &lp_build_exp, &expf, exp2_values, Elements(exp2_values), 18.0 },
    {"log", &lp_build_log_safe, &logf, log2_values, Elements(log2_values), 20.0 
},
@@ -283,7 +306,7 @@ unary_tests[] = {
    {"rsqrt", &lp_build_rsqrt, &rsqrtf, rsqrt_values, Elements(rsqrt_values), 
20.0 },
    {"sin", &lp_build_sin, &sinf, sincos_values, Elements(sincos_values), 20.0 
},
    {"cos", &lp_build_cos, &cosf, sincos_values, Elements(sincos_values), 20.0 
},
-   {"sgn", &lp_build_sgn, &sgnf, exp2_values, Elements(exp2_values), 20.0 },
+   {"sgn", &lp_build_sgn, &sgnf, sgn_values, Elements(sgn_values), 20.0 },
    {"round", &lp_build_round, &nearbyintf, round_values, 
Elements(round_values), 24.0 },
    {"trunc", &lp_build_trunc, &truncf, round_values, Elements(round_values), 
24.0 },
    {"floor", &lp_build_floor, &floorf, round_values, Elements(round_values), 
24.0 },
@@ -441,6 +464,13 @@ test_unary(unsigned verbose, FILE *fp, const struct 
unary_test_t *test, unsigned
             expected_pass = FALSE;
          }
 
+         if (test->ref == &expf && util_inf_sign(testval) == -1) {
+            /* XXX: 64bits MSVCRT's expf(-inf) returns -inf instead of 0 */
+#if defined(_MSC_VER) && defined(_WIN64)
+            expected_pass = FALSE;
+#endif
+         }
+
          if (pass != expected_pass || verbose) {
             printf("%s(%.9g): ref = %.9g, out = %.9g, precision = %f bits, 
%s%s\n",
                   test_name, in[i], ref, out[i], precision,
-- 
2.5.0

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to