diff options
author | Paul Berry <stereotype441@gmail.com> | 2011-07-28 09:42:10 -0700 |
---|---|---|
committer | Paul Berry <stereotype441@gmail.com> | 2011-08-11 13:13:02 -0700 |
commit | 978488e96f3cb31e525518857bd93c33930a5b16 (patch) | |
tree | a1973cf79bf09b05cc408ed8c2aadb69b88e1bcc | |
parent | 43542f5a3b6cd8d08b430aef960fe04e61075e5b (diff) |
Increase the range of values used to test atan(x) and atan(x,y)
This patch ensures that Piglit tests both atan(x) and atan(x,y) for
both very small and very large inputs.
Previously, Piglit only tested the atan() functions over a small range
of input values, causing it to miss a bug in Mesa (which has since
been fixed--see Mesa commit b1b4ea0b).
-rw-r--r-- | generated_tests/builtin_function.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/generated_tests/builtin_function.py b/generated_tests/builtin_function.py index 69deb777..7a424415 100644 --- a/generated_tests/builtin_function.py +++ b/generated_tests/builtin_function.py @@ -577,6 +577,12 @@ def _make_componentwise_test_vectors(test_suite_dict): functions that operate on vectors in componentwise fashion. Examples include sin(), cos(), min(), max(), and clamp(). """ + # Make sure atan(x) and atan(x,y) don't misbehave for very large + # or very small input values. + atan_inputs = [0.0] + for exponent in (-10, -1, 0, 1, 10): + atan_inputs.append(pow(10.0, exponent)) + atan_inputs.append(-pow(10.0, exponent)) def f(name, arity, glsl_version, python_equivalent, alternate_scalar_arg_indices, test_inputs, tolerance_function = _strict_tolerance): @@ -623,8 +629,8 @@ def _make_componentwise_test_vectors(test_suite_dict): f('tan', 1, '1.10', np.tan, None, [np.linspace(-np.pi, np.pi, 4)], _trig_tolerance) f('asin', 1, '1.10', np.arcsin, None, [np.linspace(-1.0, 1.0, 4)], _trig_tolerance) f('acos', 1, '1.10', np.arccos, None, [np.linspace(-1.0, 1.0, 4)], _trig_tolerance) - f('atan', 1, '1.10', np.arctan, None, [np.linspace(-2.0, 2.0, 4)], _trig_tolerance) - f('atan', 2, '1.10', _arctan2, None, [np.linspace(-2.0, 2.0, 3), np.linspace(-2.0, 2.0, 3)], _trig_tolerance) + f('atan', 1, '1.10', np.arctan, None, [atan_inputs], _trig_tolerance) + f('atan', 2, '1.10', _arctan2, None, [atan_inputs, atan_inputs], _trig_tolerance) f('pow', 2, '1.10', _pow, None, [np.linspace(0.0, 2.0, 4), np.linspace(-2.0, 2.0, 4)]) f('exp', 1, '1.10', np.exp, None, [np.linspace(-2.0, 2.0, 4)]) f('log', 1, '1.10', np.log, None, [np.linspace(0.01, 2.0, 4)]) |