diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/gcc~13/decimal-float.html | |
new repository
Diffstat (limited to 'devdocs/gcc~13/decimal-float.html')
| -rw-r--r-- | devdocs/gcc~13/decimal-float.html | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/devdocs/gcc~13/decimal-float.html b/devdocs/gcc~13/decimal-float.html new file mode 100644 index 00000000..e6d3a25c --- /dev/null +++ b/devdocs/gcc~13/decimal-float.html @@ -0,0 +1,8 @@ +<div class="section-level-extent" id="Decimal-Float"> <div class="nav-panel"> <p> Next: <a href="hex-floats" accesskey="n" rel="next">Hex Floats</a>, Previous: <a href="half-precision" accesskey="p" rel="prev">Half-Precision Floating Point</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Decimal-Floating-Types"><span>6.14 Decimal Floating Types<a class="copiable-link" href="#Decimal-Floating-Types"> ¶</a></span></h1> <p>As an extension, GNU C supports decimal floating types as defined in the N1312 draft of ISO/IEC WDTR24732. Support for decimal floating types in GCC will evolve as the draft technical report changes. Calling conventions for any target might also change. Not all targets support decimal floating types. </p> <p>The decimal floating types are <code class="code">_Decimal32</code>, <code class="code">_Decimal64</code>, and <code class="code">_Decimal128</code>. They use a radix of ten, unlike the floating types <code class="code">float</code>, <code class="code">double</code>, and <code class="code">long double</code> whose radix is not specified by the C standard but is usually two. </p> <p>Support for decimal floating types includes the arithmetic operators add, subtract, multiply, divide; unary arithmetic operators; relational operators; equality operators; and conversions to and from integer and other floating types. Use a suffix ‘<samp class="samp">df</samp>’ or ‘<samp class="samp">DF</samp>’ in a literal constant of type <code class="code">_Decimal32</code>, ‘<samp class="samp">dd</samp>’ or ‘<samp class="samp">DD</samp>’ for <code class="code">_Decimal64</code>, and ‘<samp class="samp">dl</samp>’ or ‘<samp class="samp">DL</samp>’ for <code class="code">_Decimal128</code>. </p> <p>GCC support of decimal float as specified by the draft technical report is incomplete: </p> <ul class="itemize mark-bullet"> <li>When the value of a decimal floating type cannot be represented in the integer type to which it is being converted, the result is undefined rather than the result value specified by the draft technical report. </li> +<li>GCC does not provide the C library functionality associated with <samp class="file">math.h</samp>, <samp class="file">fenv.h</samp>, <samp class="file">stdio.h</samp>, <samp class="file">stdlib.h</samp>, and <samp class="file">wchar.h</samp>, which must come from a separate C library implementation. Because of this the GNU C compiler does not define macro <code class="code">__STDC_DEC_FP__</code> to indicate that the implementation conforms to the technical report. </li> +</ul> <p>Types <code class="code">_Decimal32</code>, <code class="code">_Decimal64</code>, and <code class="code">_Decimal128</code> are supported by the DWARF debug information format. </p> </div> <div class="nav-panel"> <p> Next: <a href="hex-floats">Hex Floats</a>, Previous: <a href="half-precision">Half-Precision Floating Point</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Decimal-Float.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Decimal-Float.html</a> + </p> +</div> |
