1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3
"http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
8
<keyword>Symbolic Math Constants</keyword>
13
<refentrytitle>Symbolic Math Constants</refentrytitle>
17
<year>2007-2011</year>
18
<holder>The Khronos Group Inc.
19
Permission is hereby granted, free of charge, to any person obtaining a
20
copy of this software and/or associated documentation files (the
21
"Materials"), to deal in the Materials without restriction, including
22
without limitation the rights to use, copy, modify, merge, publish,
23
distribute, sublicense, and/or sell copies of the Materials, and to
24
permit persons to whom the Materials are furnished to do so, subject to
25
the condition that this copyright notice and permission notice shall be included
26
in all copies or substantial portions of the Materials.</holder>
29
<manvolnum>3</manvolnum>
32
<!-- ================================ SYNOPSIS -->
34
<refnamediv id="SymbolicMathConstants">
35
<refname>Symbolic Math Constants</refname>
38
The following symbolic constants are available.
42
<!-- ================================ DESCRIPTION -->
44
<refsect1 id="description"><title>Built-in Math Constants</title>
46
The following symbolic constants are available. Their values are of type
47
<type>float</type> and are accurate within the precision of a single precision
48
floating-point number.
51
<informaltable frame="all">
52
<tgroup cols="2" align="left" colsep="1" rowsep="1">
53
<colspec colname="col1" colnum="1" />
54
<colspec colname="col2" colnum="2" />
58
<entry>Constant Name</entry>
59
<entry>Description</entry>
66
<entry> MAXFLOAT </entry>
68
Value of maximum non-infinite single-precision floating-point number.
73
<entry> HUGE_VALF </entry>
76
A positive float constant expression. <constant>HUGE_VALF</constant> evaluates to +infinity.
77
Used as an error value returned by the
78
<citerefentry href="mathFunctions"><refentrytitle>built-in math functions</refentrytitle></citerefentry>.
83
<entry> INFINITY </entry>
86
A constant expression of type <type>float</type> representing positive or unsigned infinity.
94
A constant expression of type <type>float</type> representing a quiet NaN.
103
If double precision is supported by the device, the following symbolic constant will
107
<informaltable frame="all">
108
<tgroup cols="2" align="left" colsep="1" rowsep="1">
109
<colspec colname="col1" colnum="1" />
110
<colspec colname="col2" colnum="2" />
114
<entry>Constant Name</entry>
115
<entry>Description</entry>
128
A positive double constant expression. <constant>HUGE_VAL</constant>
129
evaluates to +infinity. Used as an error value returned by the
130
built-in math functions.
139
The following constants are also available. They are of type <type>float</type>
140
and are accurate within the precision of the <type>float</type> type.
143
<informaltable frame="all">
144
<tgroup cols="2" align="left" colsep="1" rowsep="1">
145
<colspec colname="col1" colnum="1" />
146
<colspec colname="col2" colnum="2" />
150
<entry>Constant Name</entry>
151
<entry>Description</entry>
158
<entry>Value of e</entry>
161
<entry>M_LOG2E_F</entry>
162
<entry>Value of log<subscript>2</subscript>e</entry>
165
<entry>M_LOG10E_F</entry>
166
<entry>Value of log<subscript>10</subscript>e</entry>
169
<entry>M_LN2_F</entry>
170
<entry>Value of log<subscript>e</subscript>2</entry>
173
<entry>M_LN10_F</entry>
174
<entry>Value of log<subscript>e</subscript>10</entry>
177
<entry>M_PI_F</entry>
178
<entry>Value of pi</entry>
181
<entry>M_PI_2_F</entry>
182
<entry>Value of pi / 2</entry>
185
<entry>M_PI_4_F</entry>
186
<entry>Value of pi / 4</entry>
189
<entry>M_1_PI_F</entry>
190
<entry>Value of 1 / pi</entry>
193
<entry>M_2_PI_F</entry>
194
<entry>Value of 2 / pi</entry>
197
<entry>M_2_SQRTPI_F</entry>
198
<entry>Value of 2 / (square root of pi)</entry>
201
<entry>M_SQRT2_F</entry>
202
<entry>Value of square root of 2</entry>
205
<entry>M_SQRT1_2_F</entry>
206
<entry>Value of 1 / (square root of 2)</entry>
213
If double precision is supported by the device, the following macros and constants
214
are also available. They are of type <type>double</type> and are accurate within the
215
precision of the <type>double</type> type.
218
<informaltable frame="all">
219
<tgroup cols="2" align="left" colsep="1" rowsep="1">
220
<colspec colname="col1" colnum="1" />
221
<colspec colname="col2" colnum="2" />
225
<entry>Constant Name</entry>
226
<entry>Description</entry>
233
<entry>Value of e</entry>
236
<entry>M_LOG2E</entry>
237
<entry>Value of log<subscript>2</subscript>e</entry>
240
<entry>M_LOG10E</entry>
241
<entry>Value of log<subscript>10</subscript>e</entry>
245
<entry>Value of log<subscript>e</subscript>2</entry>
248
<entry>M_LN10</entry>
249
<entry>Value of log<subscript>e</subscript>10</entry>
253
<entry>Value of pi</entry>
256
<entry>M_PI_2</entry>
257
<entry>Value of pi / 2</entry>
260
<entry>M_PI_4</entry>
261
<entry>Value of pi / 4</entry>
264
<entry>M_1_PI</entry>
265
<entry>Value of 1 / pi</entry>
268
<entry>M_2_PI</entry>
269
<entry>Value of 2 / pi</entry>
272
<entry>M_2_SQRTPI</entry>
273
<entry>Value of 2 / (square root of pi)</entry>
276
<entry>M_SQRT2</entry>
277
<entry>Value of square root of 2</entry>
280
<entry>M_SQRT1_2</entry>
281
<entry>Value of 1 / (square root of 2)</entry>
288
The following constants are also available. They are of type <type>half</type> and
289
are accurate within the precision of the <type>half</type> type. An application that
290
wants to use <type>half</type> and <type>half<replaceable>n</replaceable></type>
291
types will need to include the <code>#pragma OPENCL EXTENSION
292
<citerefentry><refentrytitle>cl_khr_fp16</refentrytitle></citerefentry> : enable</code>
296
<informaltable frame="all">
297
<tgroup cols="2" align="left" colsep="1" rowsep="1">
298
<colspec colname="col1" colnum="1" />
299
<colspec colname="col2" colnum="2" />
303
<entry>Constant</entry>
304
<entry>Description</entry>
311
<entry>Value of e</entry>
314
<entry>M_LOG2E_H</entry>
315
<entry>Value of log<subscript>2</subscript>e</entry>
318
<entry>M_LOG10E_H</entry>
319
<entry>Value of log<subscript>10</subscript>e</entry>
322
<entry>M_LN2_H</entry>
323
<entry>Value of log<subscript>e</subscript>2</entry>
326
<entry>M_LN10_H</entry>
327
<entry>Value of log<subscript>e</subscript>10</entry>
330
<entry>M_PI_H</entry>
331
<entry>Value of pi</entry>
334
<entry>M_PI_2_H</entry>
335
<entry>Value of pi / 2</entry>
338
<entry>M_PI_4_H</entry>
339
<entry>Value of pi / 4</entry>
342
<entry>M_1_PI_H</entry>
343
<entry>Value of 1 / pi</entry>
346
<entry>M_2_PI_H</entry>
347
<entry>Value of 2 / pi</entry>
350
<entry>M_2_SQRTPI_H</entry>
351
<entry>Value of 2 / (square root of pi)</entry>
354
<entry>M_SQRT2_H</entry>
355
<entry>Value of square root of 2</entry>
358
<entry>M_SQRT1_2_H</entry>
359
<entry>Value of 1 / (square root of 2)</entry>
366
<!-- ================================ SPECIFICATION -->
367
<!-- Set the "uri" attribute in the <olink /> element to the "named destination" for the PDF page
369
<refsect1 id="specification"><title>Specification</title>
372
<imagedata fileref="pdficon_small1.gif" format="gif" />
375
<olink uri="mathConstants">OpenCL Specification</olink>
379
<!-- ================================ ALSO SEE -->
381
<refsect1 id="seealso"><title>Also see</title>
383
<citerefentry href="mathFunctions"><refentrytitle>Math Functions</refentrytitle></citerefentry>,
384
<citerefentry href="FP_CONTRACT"><refentrytitle>Floating Point Pragma</refentrytitle></citerefentry>,
385
<citerefentry href="macroLimits"><refentrytitle>Macros and Limits</refentrytitle></citerefentry>
389
<!-- ============================== COPYRIGHT -->
390
<!-- Content included from copyright.inc.xsl -->
392
<refsect3 id="Copyright"><title></title>
394
<imagedata fileref="KhronosLogo.jpg" format="jpg" />