[2/2] builtin_function*py: more test data for "trunc"

Submitted by Andres Gomez on May 4, 2016, 5:02 p.m.

Details

Message ID 1462381332-12594-2-git-send-email-agomez@igalia.com
State Accepted
Commit 6cc46e61a58272e188eb0142ab32ea9a15ea20a9
Headers show
Series "Series without cover letter" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Andres Gomez May 4, 2016, 5:02 p.m.
A trunc op in a float value may be implemented through a roundtrip cast
to a int based type.  We add now some additional values beyond each
bitsize edge to check also these cases.

Signed-off-by: Andres Gomez <agomez@igalia.com>
---
 generated_tests/builtin_function.py      |  9 +++++++--
 generated_tests/builtin_function_fp64.py | 12 ++++++++++--
 2 files changed, 17 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/generated_tests/builtin_function.py b/generated_tests/builtin_function.py
index 9677a3a..3a8fbdc 100644
--- a/generated_tests/builtin_function.py
+++ b/generated_tests/builtin_function.py
@@ -865,10 +865,15 @@  def _make_componentwise_test_vectors(test_suite_dict):
 
     # Note: with trunc we want to test values in which the floating
     # point exponent is < 0, > 23 or in the middle. Hence, we append
-    # some numbers to cover all possible scenarios.
+    # some numbers to cover all possible scenarios. In addition, we
+    # want to check bitsize barriers (> 32, > 64, etc.) in case the
+    # conversion is done with a cast to and from another int based
+    # type.
     f('trunc', 1, 130, _trunc, None,
       [np.append(np.linspace(-2.0, 2.0, 8),
-                 [0.0, 45027112.0, -45027112.0])])
+                 [0.0, 45027112.0, -45027112.0,
+                  1.9584199e10, -1.9584199e10,
+                  4.5027112e19, -4.5027112e19])])
 
     # Note: the direction of rounding used by round() is not specified
     # for half-integer values, so we test it over a range that doesn't
diff --git a/generated_tests/builtin_function_fp64.py b/generated_tests/builtin_function_fp64.py
index d10d946..6ad8180 100644
--- a/generated_tests/builtin_function_fp64.py
+++ b/generated_tests/builtin_function_fp64.py
@@ -742,10 +742,18 @@  def _make_componentwise_test_vectors(test_suite_dict):
 
     # Note: with trunc we want to test values in which the floating
     # point exponent is < 0, > 52 or in the middle. Hence, we append
-    # some numbers to cover all possible scenarios.
+    # some numbers to cover all possible scenarios. In addition, we
+    # want to check bitsize barriers (> 32, > 64, etc.) in case the
+    # conversion is done with a cast to and from another int based
+    # type.
     f('trunc', 1, _trunc, None,
       [np.append(np.linspace(-2.0, 2.0, 8),
-                 [0.0, 4.5027112340958570e19, -4.5027112340958570e19])])
+                 [0.0, 45027112.98414, -45027112.98414,
+                  19584198736.47329, -19584198736.47329,
+                  7.51654162319e17, -7.51654162319e17,
+                  4.502711234095857e19, -4.5027112340958570e19,
+                  8.654196813385455e39, -8.6541968133854550e39,
+                  6.54965168513655e83, -6.54965168513655e83])])
 
     # Note: the direction of rounding used by round() is not specified
     # for half-integer values, so we test it over a range that doesn't