[Beignet] [PATCH] libocl: fix degrees function precision issue.

Luo, Xionghu xionghu.luo at intel.com
Thu Aug 6 01:30:53 PDT 2015


I sent the v2 patch which include half degrees function fix, please push that one and ignore this. Thanks.

Luo Xionghu
Best Regards

-----Original Message-----
From: Zhigang Gong [mailto:zhigang.gong at linux.intel.com] 
Sent: Thursday, August 6, 2015 4:27 PM
To: Luo, Xionghu; beignet at lists.freedesktop.org
Subject: RE: [Beignet] [PATCH] libocl: fix degrees function precision issue.

LGTM, thx.

> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf 
> Of xionghu.luo at intel.com
> Sent: Thursday, August 6, 2015 3:58 PM
> To: beignet at lists.freedesktop.org
> Cc: xionghu.luo at intel.com
> Subject: [Beignet] [PATCH] libocl: fix degrees function precision issue.
> 
> From: Luo Xionghu <xionghu.luo at intel.com>
> 
> should define and use M_180_PI_F directly instead of using 180/M_PI_F.
> 
> Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
> ---
>  backend/src/libocl/include/ocl_float.h     | 1 +
>  backend/src/libocl/tmpl/ocl_common.tmpl.cl | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/backend/src/libocl/include/ocl_float.h
> b/backend/src/libocl/include/ocl_float.h
> index 916233b..e63eaf9 100644
> --- a/backend/src/libocl/include/ocl_float.h
> +++ b/backend/src/libocl/include/ocl_float.h
> @@ -88,6 +88,7 @@ INLINE_OVERLOADABLE int __ocl_finitef (float x){
>  #define M_PI_4_F     0.7853981633974483F
>  #define M_1_PI_F     0.3183098861837907F
>  #define M_2_PI_F     0.6366197723675814F
> +#define M_180_PI_F   57.295779513082321F
>  #define M_2_SQRTPI_F 1.1283791670955126F
>  #define M_SQRT2_F    1.4142135623730951F
>  #define M_SQRT1_2_F  0.7071067811865476F diff --git 
> a/backend/src/libocl/tmpl/ocl_common.tmpl.cl
> b/backend/src/libocl/tmpl/ocl_common.tmpl.cl
> index 76aca2b..136fe70 100644
> --- a/backend/src/libocl/tmpl/ocl_common.tmpl.cl
> +++ b/backend/src/libocl/tmpl/ocl_common.tmpl.cl
> @@ -44,7 +44,7 @@ OVERLOADABLE float clamp(float v, float l, float u) 
> {
> 
> 
>  OVERLOADABLE float degrees(float radians) {
> -  return (180 / M_PI_F) * radians;
> +  return M_180_PI_F * radians;
>  }
>  OVERLOADABLE float radians(float degrees) {
>    return (M_PI_F / 180) * degrees;
> --
> 1.9.1
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet



More information about the Beignet mailing list