logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Symbolic_Math_Constants - The following symbolic constants are available.

Authors

TheKhronosGroup

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.
       ┌───────────────┬───────────────────────────────────────┐
       │ ConstantNameDescription                           │
       ├───────────────┼───────────────────────────────────────┤
       │ MAXFLOAT      │ Value of maximum non-infinite         │
       │               │ single-precision floating-point       │
       │               │ number.                               │
       ├───────────────┼───────────────────────────────────────┤
       │ HUGE_VALF     │ A positive float constant expression. │
       │               │ HUGE_VALF evaluates to +infinity.     │
       │               │ Used as an error value returned by    │
       │               │ the mathFunctions(3clc).              │
       ├───────────────┼───────────────────────────────────────┤
       │ INFINITY      │ A constant expression of type float   │
       │               │ representing positive or unsigned     │
       │               │ infinity.                             │
       ├───────────────┼───────────────────────────────────────┤
       │ NAN           │ A 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:
       ┌───────────────┬──────────────────────────────────────┐
       │ ConstantNameDescription                          │
       ├───────────────┼──────────────────────────────────────┤
       │ HUGE_VAL      │                                      │
       │               │        A 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.
       ┌───────────────┬──────────────────────────────────┐
       │ ConstantNameDescription                      │
       ├───────────────┼──────────────────────────────────┤
       │ M_E_F         │ Value of e                       │
       ├───────────────┼──────────────────────────────────┤
       │ M_LOG2E_F     │ Value of log<sub>2</sub>e        │
       ├───────────────┼──────────────────────────────────┤
       │ M_LOG10E_F    │ Value of log<sub>10</sub>e       │
       ├───────────────┼──────────────────────────────────┤
       │ M_LN2_F       │ Value of log<sub>e</sub>2        │
       ├───────────────┼──────────────────────────────────┤
       │ M_LN10_F      │ Value of log<sub>e</sub>10       │
       ├───────────────┼──────────────────────────────────┤
       │ M_PI_F        │ Value of pi                      │
       ├───────────────┼──────────────────────────────────┤
       │ M_PI_2_F      │ Value of pi / 2                  │
       ├───────────────┼──────────────────────────────────┤
       │ M_PI_4_F      │ Value of pi / 4                  │
       ├───────────────┼──────────────────────────────────┤
       │ M_1_PI_F      │ Value of 1 / pi                  │
       ├───────────────┼──────────────────────────────────┤
       │ M_2_PI_F      │ Value of 2 / pi                  │
       ├───────────────┼──────────────────────────────────┤
       │ M_2_SQRTPI_F  │ Value of 2 / (square root of pi) │
       ├───────────────┼──────────────────────────────────┤
       │ M_SQRT2_F     │ Value of square root of 2        │
       ├───────────────┼──────────────────────────────────┤
       │ M_SQRT1_2_F   │ Value 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.
       ┌───────────────┬──────────────────────────────────┐
       │ ConstantNameDescription                      │
       ├───────────────┼──────────────────────────────────┤
       │ M_E           │ Value of e                       │
       ├───────────────┼──────────────────────────────────┤
       │ M_LOG2E       │ Value of log<sub>2</sub>e        │
       ├───────────────┼──────────────────────────────────┤
       │ M_LOG10E      │ Value of log<sub>10</sub>e       │
       ├───────────────┼──────────────────────────────────┤
       │ M_LN2         │ Value of log<sub>e</sub>2        │
       ├───────────────┼──────────────────────────────────┤
       │ M_LN10        │ Value of log<sub>e</sub>10       │
       ├───────────────┼──────────────────────────────────┤
       │ M_PI          │ Value of pi                      │
       ├───────────────┼──────────────────────────────────┤
       │ M_PI_2        │ Value of pi / 2                  │
       ├───────────────┼──────────────────────────────────┤
       │ M_PI_4        │ Value of pi / 4                  │
       ├───────────────┼──────────────────────────────────┤
       │ M_1_PI        │ Value of 1 / pi                  │
       ├───────────────┼──────────────────────────────────┤
       │ M_2_PI        │ Value of 2 / pi                  │
       ├───────────────┼──────────────────────────────────┤
       │ M_2_SQRTPI    │ Value of 2 / (square root of pi) │
       ├───────────────┼──────────────────────────────────┤
       │ M_SQRT2       │ Value of square root of 2        │
       ├───────────────┼──────────────────────────────────┤
       │ M_SQRT1_2     │ Value 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_H        │ Value of e                       │
       ├──────────────┼──────────────────────────────────┤
       │ M_LOG2E_H    │ Value of log<sub>2</sub>e        │
       ├──────────────┼──────────────────────────────────┤
       │ M_LOG10E_H   │ Value of log<sub>10</sub>e       │
       ├──────────────┼──────────────────────────────────┤
       │ M_LN2_H      │ Value of log<sub>e</sub>2        │
       ├──────────────┼──────────────────────────────────┤
       │ M_LN10_H     │ Value of log<sub>e</sub>10       │
       ├──────────────┼──────────────────────────────────┤
       │ M_PI_H       │ Value of pi                      │
       ├──────────────┼──────────────────────────────────┤
       │ M_PI_2_H     │ Value of pi / 2                  │
       ├──────────────┼──────────────────────────────────┤
       │ M_PI_4_H     │ Value of pi / 4                  │
       ├──────────────┼──────────────────────────────────┤
       │ M_1_PI_H     │ Value of 1 / pi                  │
       ├──────────────┼──────────────────────────────────┤
       │ M_2_PI_H     │ Value of 2 / pi                  │
       ├──────────────┼──────────────────────────────────┤
       │ M_2_SQRTPI_H │ Value of 2 / (square root of pi) │
       ├──────────────┼──────────────────────────────────┤
       │ M_SQRT2_H    │ Value of square root of 2        │
       ├──────────────┼──────────────────────────────────┤
       │ M_SQRT1_2_H  │ Value of 1 / (square root of 2)  │
       └──────────────┴──────────────────────────────────┘

Name

       Symbolic_Math_Constants - The following symbolic constants are available.

Notes

        1. OpenCL Specification
           page 251, section 6.12.2 - Table at end of Math Functions

The Khronos Group                                  11/18/2024                         SYMBOLICMATHCONSTA(3clc)

See Also

mathFunctions(3clc), FP_CONTRACT(3clc), macroLimits(3clc)

Specification

OpenCLSpecification[1]

See Also