[Libclc-dev] [PATCH] Add floating-point macro definitions v2

Jan Vesely jan.vesely at rutgers.edu
Thu Dec 19 19:08:08 PST 2013


On Thu, 2013-12-19 at 18:09 -0800, Tom Stellard wrote:
> From: Tom Stellard <thomas.stellard at amd.com>
> 
> v2:
>   - Fix typo.
> ---
>  generic/include/clc/clc.h               |  3 +++
>  generic/include/clc/float/definitions.h | 24 ++++++++++++++++++++++++
>  2 files changed, 27 insertions(+)
>  create mode 100644 generic/include/clc/float/definitions.h
> 
> diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
> index 8f0dbd3..d07c8b5 100644
> --- a/generic/include/clc/clc.h
> +++ b/generic/include/clc/clc.h
> @@ -62,6 +62,9 @@
>  #include <clc/math/native_sqrt.h>
>  #include <clc/math/rsqrt.h>
>  
> +/* 6.11.2.1 Floating-point macros */
> +#include <clc/float/definitions.h>
> +
>  /* 6.11.3 Integer Functions */
>  #include <clc/integer/abs.h>
>  #include <clc/integer/abs_diff.h>
> diff --git a/generic/include/clc/float/definitions.h b/generic/include/clc/float/definitions.h
> new file mode 100644
> index 0000000..e6ef1d8
> --- /dev/null
> +++ b/generic/include/clc/float/definitions.h
> @@ -0,0 +1,24 @@
> +#define FLT_DIG 	6
> +#define FLT_MANT_DIG 	24
> +#define FLT_MAX_10_EXP 	+38
> +#define FLT_MAX_EXP 	+128
> +#define FLT_MIN_10_EXP 	-37
> +#define FLT_MIN_EXP 	-125
> +#define FLT_RADIX 	2
> +#define FLT_MAX 	0x1.fffffep127f
> +#define FLT_MIN 	0x1.0p-126f
> +#define FLT_EPSILON 	0x1.0p-23f
> +
> +#ifdef cl_khr_fp64
> +
> +#define DBL_DIG 	15
> +#define DBL_MANT_DIG 	53
> +#define DBL_MAX_10_EXP 	+308
> +#define DBL_MAX_EXP 	+1024
> +#define DBL_MIN_10_EXP 	-307
> +#define DBL_MIN_EXP 	-1021
> +#define DBL_MAX 	0x1.fffffffffffffp1023
> +#define DBL_MIN 	0x1.0p-1022
> +#define DBL_EPSILON 	0x1.0p-52
> +
> +#endif

Not sure what tag I can add, the constants match Khronos.
Reviewed-by: Jan Vesely <jan.vesely at rutgers.edu>
-- 
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/libclc-dev/attachments/20131219/60c9e015/attachment.sig>


More information about the Libclc-dev mailing list