[Piglit] [PATCH 2/2] builtin_function*py: more test data for "trunc"
Andres Gomez
agomez at igalia.com
Wed May 4 17:02:12 UTC 2016
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 at igalia.com>
---
generated_tests/builtin_function.py | 9 +++++++--
generated_tests/builtin_function_fp64.py | 12 ++++++++++--
2 files changed, 17 insertions(+), 4 deletions(-)
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
--
2.8.0.rc3
More information about the Piglit
mailing list