~ubuntu-branches/ubuntu/trusty/khronos-opencl-man/trusty

« back to all changes in this revision

Viewing changes to fast_normalize.xml

  • Committer: Package Import Robot
  • Author(s): Mathieu Malaterre
  • Date: 2013-05-21 18:06:15 UTC
  • Revision ID: package-import@ubuntu.com-20130521180615-6e0s2n3pai95ip2f
Tags: upstream-1.0~svn21772
ImportĀ upstreamĀ versionĀ 1.0~svn21772

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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" [
 
4
<!ENTITY geometricFunctionsInc SYSTEM "geometricFunctionsInc.xml">
 
5
]>
 
6
 
 
7
<refentry>
 
8
    <refentryinfo>
 
9
        <keywordset>
 
10
            <keyword>fast_normalize</keyword>
 
11
        </keywordset>
 
12
    </refentryinfo>
 
13
 
 
14
    <refmeta>
 
15
        <refentrytitle>fast_normalize</refentrytitle>
 
16
 
 
17
        <refmiscinfo>
 
18
            <copyright>
 
19
                <year>2007-2011</year>
 
20
                <holder>The Khronos Group Inc.
 
21
 Permission is hereby granted, free of charge, to any person obtaining a
 
22
copy of this software and/or associated documentation files (the
 
23
"Materials"), to deal in the Materials without restriction, including
 
24
without limitation the rights to use, copy, modify, merge, publish,
 
25
distribute, sublicense, and/or sell copies of the Materials, and to
 
26
permit persons to whom the Materials are furnished to do so, subject to
 
27
the condition that this copyright notice and permission notice shall be included
 
28
in all copies or substantial portions of the Materials.</holder>
 
29
            </copyright>
 
30
        </refmiscinfo>
 
31
        <manvolnum>3</manvolnum>
 
32
    </refmeta>
 
33
 
 
34
<!-- ================================ SYNOPSIS -->
 
35
 
 
36
    <refnamediv id="fast_normalize">
 
37
        <refname>fast_normalize</refname>
 
38
 
 
39
        <refpurpose>
 
40
            Normal vector length 1.
 
41
        </refpurpose>
 
42
    </refnamediv>
 
43
 
 
44
    <refsynopsisdiv xmlns:xlink="http://www.w3.org/1999/xlink"><title></title>
 
45
        <funcsynopsis>
 
46
            <funcprototype>
 
47
                <funcdef>
 
48
                    <link xlink:href="vectorDataTypes.html">float<replaceable>n</replaceable></link>
 
49
                    <function>
 
50
                        fast_normalize
 
51
                    </function>
 
52
                </funcdef>
 
53
                <paramdef><link xlink:href="vectorDataTypes.html">float<replaceable>n</replaceable></link><parameter>p</parameter></paramdef>
 
54
            </funcprototype>
 
55
        </funcsynopsis>
 
56
 
 
57
    </refsynopsisdiv>
 
58
 
 
59
<!-- ================================ DESCRIPTION  -->
 
60
 
 
61
    <refsect1 id="description"><title>Description</title>
 
62
        <para>
 
63
          Returns a vector in the same direction as <varname>p</varname> but with a length of 1.
 
64
          <function>fast_normalize</function> is computed as:
 
65
<literallayout>          <varname>p</varname> * <citerefentry href="sqrt"><refentrytitle>half_sqrt</refentrytitle></citerefentry>(<varname>p.x</varname><superscript>2</superscript> + <varname>p.y</varname><superscript>2</superscript> +...)</literallayout>
 
66
        </para>
 
67
 
 
68
        <para>
 
69
          The result shall be within 8192 ulps error from the infinitely precise result of:
 
70
<literallayout>          if ( <citerefentry href="any"><refentrytitle>all</refentrytitle></citerefentry>(<varname>p</varname> == 0.0f))
 
71
                    <varname>result = p</varname>;
 
72
          else
 
73
                    <varname>result = p</varname> /  <citerefentry><refentrytitle>sqrt</refentrytitle></citerefentry>(<varname>p.x</varname><superscript>2</superscript> + <varname>p.y</varname><superscript>2</superscript> +...);</literallayout>
 
74
        </para>
 
75
 
 
76
        <para>
 
77
            with the following exceptions:
 
78
        </para>
 
79
 
 
80
        <orderedlist>
 
81
            <listitem>
 
82
                <para>
 
83
                  If the sum of squares is greater than <constant>FLT_MAX</constant> then the
 
84
                  value of the floating-point values in the result vector are undefined.
 
85
                </para>
 
86
            </listitem>
 
87
 
 
88
            <listitem>
 
89
                <para>
 
90
                  If the sum of squares is less than <constant>FLT_MIN</constant> then the
 
91
                  implementation may return back <varname>p</varname>.
 
92
                </para>
 
93
            </listitem>
 
94
 
 
95
            <listitem>
 
96
                <para>
 
97
                  If the device is in 'denorms are flushed to zero'
 
98
                  mode, individual operand elements with magnitude less than
 
99
                  <citerefentry><refentrytitle>sqrt</refentrytitle></citerefentry>(<constant>FLT_MIN</constant>)
 
100
                  may be flushed to zero before proceeding with the calculation.
 
101
                </para>
 
102
            </listitem>
 
103
        </orderedlist>
 
104
    </refsect1>
 
105
 
 
106
<!-- ================================ NOTES  -->
 
107
 
 
108
    <refsect1 id="notes"><title>Notes</title>
 
109
 
 
110
        &geometricFunctionsInc;
 
111
 
 
112
    </refsect1>
 
113
 
 
114
<!-- ================================ EXAMPLE  -->
 
115
<!-- DO NOT DELETE IN CASE AN EXAMPLE IS ADDED IN THE FUTURE -->
 
116
<!--
 
117
    <refsect2 id="example1">
 
118
        <title>
 
119
            Example
 
120
        </title>
 
121
 
 
122
        <informaltable frame="none">
 
123
            <tgroup cols="1" align="left" colsep="0" rowsep="0">
 
124
                <colspec colname="col1" colnum="1" />
 
125
                <tbody>
 
126
                    <row>
 
127
                        <entry>
 
128
                            Example goes here - it will be set in "code" type with white space preserved.
 
129
                        </entry>
 
130
                    </row>
 
131
                </tbody>
 
132
            </tgroup>
 
133
        </informaltable>
 
134
    </refsect2>
 
135
-->
 
136
 
 
137
<!-- ================================ SPECIFICATION  -->
 
138
<!-- Set the "uri" attribute in the <olink /> element to the "named destination" for the PDF page
 
139
-->
 
140
    <refsect1 id="specification"><title>Specification</title>
 
141
        <para>
 
142
            <imageobject>
 
143
                <imagedata fileref="pdficon_small1.gif" format="gif" />
 
144
            </imageobject>
 
145
 
 
146
            <olink uri="geometricFunctions">OpenCL Specification</olink>
 
147
        </para>
 
148
    </refsect1>
 
149
 
 
150
<!-- ================================ ALSO SEE  -->
 
151
 
 
152
    <refsect1 id="seealso"><title>Also see</title>
 
153
        <para>
 
154
            <citerefentry href="geometricFunctions"><refentrytitle>Geometric Functions</refentrytitle></citerefentry>
 
155
        </para>
 
156
    </refsect1>
 
157
 
 
158
<!-- ============================== COPYRIGHT -->
 
159
<!-- Content included from copyright.inc.xsl -->
 
160
 
 
161
    <refsect3 id="Copyright"><title></title>
 
162
        <imageobject>
 
163
                <imagedata fileref="KhronosLogo.jpg" format="jpg" />
 
164
        </imageobject>
 
165
        <para />
 
166
    </refsect3>
 
167
 
 
168
<!-- 17-Oct-2011 -->
 
169
</refentry>
 
170