[Piglit] [PATCH 3/3] CL: Add some basic expm1 tests

Jan Vesely jan.vesely at rutgers.edu
Fri Jan 20 16:49:25 UTC 2017


On Mon, 2017-01-16 at 20:03 -0600, Aaron Watry wrote:
> These aren't too comprehensive, but there's some checks for reasonable accuracy
> when the input is near 0.
> 
> Signed-off-by: Aaron Watry <awatry at gmail.com>
> ---
>  generated_tests/gen_cl_math_builtins.py | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/generated_tests/gen_cl_math_builtins.py b/generated_tests/gen_cl_math_builtins.py
> index e9cfebf..f609d73 100644
> --- a/generated_tests/gen_cl_math_builtins.py
> +++ b/generated_tests/gen_cl_math_builtins.py
> @@ -27,7 +27,7 @@ from __future__ import print_function, division, absolute_import
>  import os
>  
>  from genclbuiltins import gen, NEGNAN
> -from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh, exp
> +from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh, e, exp
>  from math import fabs, fmod, log10, log1p, pi, pow, sin, sinh, sqrt, tan, tanh

I think you should import and use math.expm1

Jan
>  
>  CLC_VERSION_MIN = {
> @@ -51,6 +51,7 @@ CLC_VERSION_MIN = {
>      'erf' : 10,
>      'erfc' : 10,
>      'exp' : 10,
> +    'expm1' : 10,
>      'fabs' : 10,
>      'fdim' : 10,
>      'floor' : 10,
> @@ -266,6 +267,15 @@ tests = {
>          ],
>          'tolerance' : 3
>      },
> +    'expm1' : {
> +        'arg_types' : [F, F],
> +        'function_type': 'ttt',
> +        'values' : [
> +            [0.0, e-1.0, 1.00000000005e-10, 1e-16, float("inf"), exp(-pi)-1, float("nan") ], # Result
> +            [0.0, 1.0, 1e-10, 1e-16, 710, -pi, float("nan")]  # Arg0
> +        ],
> +        'tolerance' : 3
> +    },
>      'fabs' : {
>          'arg_types' : [F, F],
>          'function_type': 'ttt',
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20170120/98db3b2e/attachment.sig>


More information about the Piglit mailing list