%PDF- %PDF-
| Direktori : /usr/share/doc/imath-devel/html/functions/ |
| Current File : //usr/share/doc/imath-devel/html/functions/half_c.html |
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>C-language half-float Conversion — 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="half-float Conversion Configuration Options" href="../half_conversion.html" />
<link rel="prev" title="half Limits" href="../half_limits.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="../half_conversion.html" title="half-float Conversion Configuration Options"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="../half_limits.html" title="half Limits"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Imath</a> »</li>
<li class="nav-item nav-item-this"><a href="">C-language half-float Conversion</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="c-language-half-float-conversion">
<h1>C-language half-float Conversion<a class="headerlink" href="#c-language-half-float-conversion" title="Permalink to this headline">¶</a></h1>
<p>The <code class="docutils literal notranslate"><span class="pre">half.h</span></code> header can be included in pure C code:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf"><Imath/half.h></span><span class="cp"></span>
<span class="kt">void</span>
<span class="nf">half_example</span><span class="p">()</span>
<span class="p">{</span>
<span class="kt">float</span> <span class="n">f</span> <span class="o">=</span> <span class="mf">3.5f</span><span class="p">;</span>
<span class="n">half</span> <span class="n">h</span> <span class="o">=</span> <span class="n">imath_float_to_half</span> <span class="p">(</span><span class="n">f</span><span class="p">)</span>
<span class="kt">float</span> <span class="n">hh</span> <span class="o">=</span> <span class="n">imath_half_to_float</span> <span class="p">(</span><span class="n">h</span><span class="p">)</span>
<span class="p">}</span>
</pre></div>
</div>
<p>The only C-language operations supported for the <code class="docutils literal notranslate"><span class="pre">half</span></code> type are
conversion to and from <code class="docutils literal notranslate"><span class="pre">float</span></code>. No arithmetic operations are
currently implemented in the C interface.</p>
<dl class="cpp function">
<dt id="_CPPv419imath_half_to_float4half">
<span id="_CPPv319imath_half_to_float4half"></span><span id="_CPPv219imath_half_to_float4half"></span><span id="imath_half_to_float__half"></span><span class="target" id="half_8h_1ab0a258be1412e6e35ab70e213219f1bb"></span><em class="property">static</em> <em class="property">inline</em> float <code class="sig-name descname">imath_half_to_float</code><span class="sig-paren">(</span>half <em>h</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv419imath_half_to_float4half" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Convert half to float. </p>
</dd></dl>
<dl class="cpp function">
<dt>
<span class="target" id="half_8h_1ab0a258be1412e6e35ab70e213219f1bb"></span><em class="property">static</em> <em class="property">inline</em> float <code class="sig-name descname">imath_half_to_float</code><span class="sig-paren">(</span>half <em>h</em><span class="sig-paren">)</span><br /></dt>
<dd><p>Convert half to float. </p>
</dd></dl>
</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="../half_limits.html"
title="previous chapter">half Limits</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="../half_conversion.html"
title="next chapter">half-float Conversion Configuration Options</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/functions/half_c.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="../half_conversion.html" title="half-float Conversion Configuration Options"
>next</a> |</li>
<li class="right" >
<a href="../half_limits.html" title="half Limits"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Imath</a> »</li>
<li class="nav-item nav-item-this"><a href="">C-language half-float Conversion</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2021, Contributors to the OpenEXR Project.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.4.3.
</div>
</body>
</html>