summaryrefslogtreecommitdiff
path: root/devdocs/c/numeric%2Fmath%2Ffloat_t.html
blob: e9783b112df6fced3477dca7203f36165d697962 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
    <h1 id="firstHeading" class="firstHeading">float_t, double_t</h1>            <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code>&lt;math.h&gt;</code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">typedef /*implementation defined*/ float_t</pre>
</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">typedef /*implementation defined*/ double_t</pre>
</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr>  </table> <p>The types <code>float_t</code> and <code>double_t</code> are floating types at least as wide as <code>float</code> and <code>double</code>, respectively, and such that <code>double_t</code> is at least as wide as <code>float_t</code>. The value of <code><a href="../../types/limits/flt_eval_method" title="c/types/limits/FLT EVAL METHOD">FLT_EVAL_METHOD</a></code> determines the types of <code>float_t</code> and <code>double_t</code>.</p>
<table class="t-dsc-begin"> <tr class="t-dsc-hitem"> <th> FLT_EVAL_METHOD </th> <th> Explanation </th>
</tr> <tr class="t-dsc"> <td> <code>0</code> </td> <td> <code>float_t</code> and <code>double_t</code> are equivalent to <code>float</code> and <code>double</code>, respectively </td>
</tr> <tr class="t-dsc"> <td> <code>1</code> </td> <td> both <code>float_t</code> and <code>double_t</code> are equivalent to <code>double</code> </td>
</tr> <tr class="t-dsc"> <td> <code>2</code> </td> <td> both <code>float_t</code> and <code>double_t</code> are equivalent to <code>long double</code> </td>
</tr> <tr class="t-dsc"> <td> <code>other</code> </td> <td> both <code>float_t</code> and <code>double_t</code> are implementation defined </td>
</tr> </table> <h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include &lt;float.h&gt;
#include &lt;math.h&gt;
#include &lt;stdio.h&gt;
 
int main(void)
{
    printf("%d\n", FLT_EVAL_METHOD);
    printf("%zu  %zu\n", sizeof(float),sizeof(float_t));
    printf("%zu  %zu\n", sizeof(double),sizeof(double_t));
    return 0;
}</pre></div> <p>Possible output:</p>
<div class="text source-text"><pre data-language="c">0
4  4
8  8</pre></div> </div> <h3 id="References"> References</h3>  <ul>
<li> C11 standard (ISO/IEC 9899:2011): </li>
<ul><li> 7.12 Mathematics &lt;math.h&gt; (p: 231) </li></ul>
<li> C99 standard (ISO/IEC 9899:1999): </li>
<ul><li> 7.12 Mathematics &lt;math.h&gt; (p: 212) </li></ul>
</ul>      <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="../../types/limits/flt_eval_method" title="c/types/limits/FLT EVAL METHOD"> <span class="t-lines"><span>FLT_EVAL_METHOD</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span></span></div> </td> <td> use of extended precision for intermediate results: 0 not used, 1 <code>double</code> is used instead of <code>float</code>, 2: <code>long double</code> is used <br> <span class="t-mark">(macro constant)</span> </td>
</tr> </table>           <div class="_attribution">
  <p class="_attribution-p">
    &copy; cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br>
    <a href="https://en.cppreference.com/w/c/numeric/math/float_t" class="_attribution-link">https://en.cppreference.com/w/c/numeric/math/float_t</a>
  </p>
</div>