mathConstants(3clc)

mathConstants3clc

The following symbolic constants are available.

Built-in math constants

The following symbolic constants are available. Their values are of type float and are accurate within the precision of a single precision floating-point number.

Constant NameDescription
MAXFLOATValue of maximum non-infinite single-precision floating-point number.
HUGE_VALFA positive float constant expression. HUGE_VALF evaluates to +infinity. Used as an error value returned by the mathFunctions(3clc).
INFINITYA constant expression of type float representing positive or unsigned infinity.
NANA constant expression of type float representing a quiet NaN.

If double precision is supported by the device, the following symbolic constant will also be available:

Constant NameDescription
HUGE_VALA positive double constant expression. HUGE_VAL evaluates to +infinity. Used as an error value returned by the built-in math functions.

The following constants are also available. They are of type float and are accurate within the precision of the float type.

Constant NameDescription
M_E_FValue of e
M_LOG2E_FValue of log<sub>2</sub>e
M_LOG10E_FValue of log<sub>10</sub>e
M_LN2_FValue of log<sub>e</sub>2
M_LN10_FValue of log<sub>e</sub>10
M_PI_FValue of pi
M_PI_2_FValue of pi / 2
M_PI_4_FValue of pi / 4
M_1_PI_FValue of 1 / pi
M_2_PI_FValue of 2 / pi
M_2_SQRTPI_FValue of 2 / (square root of pi)
M_SQRT2_FValue of square root of 2
M_SQRT1_2_FValue of 1 / (square root of 2)

If double precision is supported by the device, the following macros and constants are also available. They are of type double and are accurate within the precision of the double type.

Constant NameDescription
M_EValue of e
M_LOG2EValue of log<sub>2</sub>e
M_LOG10EValue of log<sub>10</sub>e
M_LN2Value of log<sub>e</sub>2
M_LN10Value of log<sub>e</sub>10
M_PIValue of pi
M_PI_2Value of pi / 2
M_PI_4Value of pi / 4
M_1_PIValue of 1 / pi
M_2_PIValue of 2 / pi
M_2_SQRTPIValue of 2 / (square root of pi)
M_SQRT2Value of square root of 2
M_SQRT1_2Value of 1 / (square root of 2)

The following constants are also available. They are of type half and are accurate within the precision of the half type. An application that wants to use half and halfn types will need to include the #pragma OPENCL EXTENSION cl_khr_fp16(3clc) : enable directive.

ConstantDescription
M_E_HValue of e
M_LOG2E_HValue of log<sub>2</sub>e
M_LOG10E_HValue of log<sub>10</sub>e
M_LN2_HValue of log<sub>e</sub>2
M_LN10_HValue of log<sub>e</sub>10
M_PI_HValue of pi
M_PI_2_HValue of pi / 2
M_PI_4_HValue of pi / 4
M_1_PI_HValue of 1 / pi
M_2_PI_HValue of 2 / pi
M_2_SQRTPI_HValue of 2 / (square root of pi)
M_SQRT2_HValue of square root of 2
M_SQRT1_2_HValue of 1 / (square root of 2)

Specification

OpenCL Specification[1]

Notes

1.

OpenCL Specification

page 251, section 6.12.2 - Table at end of Math Functions

Releases

5 releases since Debian 8 (Jessie); the text changed 3 times.

  1. 8–9
  2. 10
  3. 11
  4. 13

Authors

The Khronos Group

From opencl-1.2-man-doc 1.0~svn33624-5.1 in Debian 13 (Trixie). Parsed by carta from the page's man source.