%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/doc/imath-devel/html/
Upload File :
Create Path :
Current File : //usr/share/doc/imath-devel/html/half_conversion.html


<!doctype html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>half-float Conversion Configuration Options &#8212; Imath Documentation</title>
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="_static/bizstyle.css" type="text/css" />
    
    <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
    <script src="_static/jquery.js"></script>
    <script src="_static/underscore.js"></script>
    <script src="_static/doctools.js"></script>
    <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <script src="_static/bizstyle.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Floating Point Representation" href="float.html" />
    <link rel="prev" title="C-language half-float Conversion" href="functions/half_c.html" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
    <!--[if lt IE 9]>
    <script src="_static/css3-mediaqueries.js"></script>
    <![endif]-->
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="float.html" title="Floating Point Representation"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="functions/half_c.html" title="C-language half-float Conversion"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Imath</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">half-float Conversion Configuration Options</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="half-float-conversion-configuration-options">
<span id="id1"></span><h1>half-float Conversion Configuration Options<a class="headerlink" href="#half-float-conversion-configuration-options" title="Permalink to this headline">ΒΆ</a></h1>
<p>The Imath library supports three options for conversion between 16-bit
half and 32-bit float:</p>
<ol class="arabic simple">
<li><p>Conversion from half to float via a 16-bit lookup table. Prior to
Imath v3.1, this was the only method supported.</p></li>
<li><p>F16C SSE instructions: single-instruction conversion for machine
architectures that support it. When available, this is the fastest
option, by far.</p></li>
<li><p>Bit-shift conversion algorithm.</p></li>
</ol>
<p>To use the F16C SSE instruction set on an architecture that supports
it, simply provide the appropriate compiler flags when building an
application that includes <code class="docutils literal notranslate"><span class="pre">half.h</span></code>. For g++ and clang,
for example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">%</span> <span class="n">cmake</span> <span class="o">-</span><span class="n">DCMAKE_CXX_FLAGS</span><span class="o">=</span><span class="s2">&quot;-m16fc&quot;</span> <span class="o">&lt;</span><span class="n">source</span> <span class="n">directory</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>When code including <code class="docutils literal notranslate"><span class="pre">half.h</span></code> is compiled with F16C enabled, it will
automatically perform conversions using the instruction set. F16C
compiler flags take precedence over other lookup-table-related Imath
CMake settings.</p>
<p>On architectures that do not support F16C, you may choose at
compile-time between the bit-shift conversion and lookup table
conversion via the <code class="docutils literal notranslate"><span class="pre">IMATH_HALF_USE_LOOKUP_TABLE</span></code> CMake option:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">%</span> <span class="n">cmake</span> <span class="o">-</span><span class="n">DIMATH_HALF_USE_LOOKUP_TABLE</span><span class="o">=</span><span class="n">OFF</span> <span class="o">&lt;</span><span class="n">source</span> <span class="n">directory</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>Note that when building and installing the Imath library itself, the
65,536-entry lookup table symbol will be compiled into the library
even if the <code class="docutils literal notranslate"><span class="pre">IMATH_HALF_USE_LOOKUP_TABLE</span></code> setting is false. This
allows applications using that installed Imath library downstream to
choose at compile time which conversion method to use.</p>
<p>Applications with memory limitations that cannot accomodate the
conversion lookup table can eliminate it from the library by building
Imath with the C preprocessor define <code class="docutils literal notranslate"><span class="pre">IMATH_HALF_NO_LOOKUP_TABLE</span></code>
defined. Note that this is a compile-time option, not a CMake setting
(making it possible for application code to choose the desired
behavior). Simply add:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#define IMATH_HALF_NO_LOOKUP_TABLE</span>
</pre></div>
</div>
<p>before including <code class="docutils literal notranslate"><span class="pre">half.h</span></code>, or define the symbol on the compile
command line.</p>
<p>Furthermore, an implementation wishing to receive <code class="docutils literal notranslate"><span class="pre">FE_OVERFLOW</span></code> and
<code class="docutils literal notranslate"><span class="pre">FE_UNDERFLOW</span></code> floating point exceptions when converting float to
half by the bit-shift algorithm can define the preprocessor symbol
<code class="docutils literal notranslate"><span class="pre">IMATH_HALF_ENABLE_FP_EXCEPTIONS</span></code> prior to including <code class="docutils literal notranslate"><span class="pre">half.h</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#define IMATH_HALF_ENABLE_FP_EXCEPTIONS</span>
</pre></div>
</div>
<p>By default, no exceptions are raised on overflow and underflow.</p>
</div>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="index.html">
              <img class="logo" src="_static/imath-logo-blue.png" alt="Logo"/>
            </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="functions/half_c.html"
                        title="previous chapter">C-language half-float Conversion</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="float.html"
                        title="next chapter">Floating Point Representation</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/half_conversion.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="float.html" title="Floating Point Representation"
             >next</a> |</li>
        <li class="right" >
          <a href="functions/half_c.html" title="C-language half-float Conversion"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Imath</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">half-float Conversion Configuration Options</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021, Contributors to the OpenEXR Project.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.4.3.
    </div>
  </body>
</html>

Zerion Mini Shell 1.0