[Piglit] [PATCH 1/1] cl: Add copysign tests
Aaron Watry
awatry at gmail.com
Tue Sep 2 15:18:52 PDT 2014
On Tue, Sep 2, 2014 at 4:58 PM, Jan Vesely <jan.vesely at rutgers.edu> wrote:
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
>
> This patch applies on top of Aaron's series.
>
> generated_tests/generate-cl-math-builtins.py | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/generated_tests/generate-cl-math-builtins.py b/generated_tests/generate-cl-math-builtins.py
> index a20f921..414e397 100644
> --- a/generated_tests/generate-cl-math-builtins.py
> +++ b/generated_tests/generate-cl-math-builtins.py
> @@ -31,6 +31,7 @@ CLC_VERSION_MIN = {
> 'acos' : 10,
> 'atan' : 10,
> 'ceil' : 10,
> + 'copysign' : 10,
> 'cos' : 10,
> 'floor' : 10,
> 'mix' : 10,
> @@ -75,6 +76,15 @@ tests = {
> [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99]
> ]
> },
> + 'copysign' : {
> + 'arg_types': [F, F, F],
> + 'function_type': 'ttt',
> + 'values': [
> + [0.0, -0.0, 1.0, -1.0, float("nan"), float("-nan"), float("nan"), float("-inf"), float("inf") ], # Result
> + [0.0, 0.0, 1.0, -1.0, float("nan"), -4.0, float("-nan"), float("inf"), float("-inf") ], # Arg0
> + [1.0, -1.0, 2.0, -2.0, float("nan"), float("nan"), 4.0, -3.0, float("inf") ], # Arg1
This has a slight quirk to it:
The 6th test in: copysign(-4.0, float("nan")) is expected to return
float("-nan") according to this, which would be seem to be
incorrect... but due to python fun, float("-nan") is turned into
float("nan") in the generated test which passes because copysign(-4.0,
nan) == nan
Did you mean to test for: copysign(float("nan"), -4.0) == -NaN ?
If you want to use -nan in any of these tests, use NEGNAN from
genclbuiltins (you'll need to add an import for it) for the
input/return value instead. The test printer turns NEGNAN into the
string "-nan" for us instead of asking python for the value.
--Aaron
> + ]
> + },
> 'cos' : {
> 'arg_types' : [F, F],
> 'function_type': 'ttt',
> --
> 1.9.3
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
More information about the Piglit
mailing list