Floating-point-implementation.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2017 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>Using the GNU Compiler Collection (GCC): Floating point implementation</title>
  20. <meta name="description" content="Using the GNU Compiler Collection (GCC): Floating point implementation">
  21. <meta name="keywords" content="Using the GNU Compiler Collection (GCC): Floating point implementation">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="C-Implementation.html#C-Implementation" rel="up" title="C Implementation">
  30. <link href="Arrays-and-pointers-implementation.html#Arrays-and-pointers-implementation" rel="next" title="Arrays and pointers implementation">
  31. <link href="Integers-implementation.html#Integers-implementation" rel="prev" title="Integers implementation">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style:oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="Floating-point-implementation"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Arrays-and-pointers-implementation.html#Arrays-and-pointers-implementation" accesskey="n" rel="next">Arrays and pointers implementation</a>, Previous: <a href="Integers-implementation.html#Integers-implementation" accesskey="p" rel="prev">Integers implementation</a>, Up: <a href="C-Implementation.html#C-Implementation" accesskey="u" rel="up">C Implementation</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  66. </div>
  67. <hr>
  68. <a name="Floating-Point"></a>
  69. <h3 class="section">4.6 Floating Point</h3>
  70. <ul>
  71. <li> <cite>The accuracy of the floating-point operations and of the library
  72. functions in <code>&lt;math.h&gt;</code> and <code>&lt;complex.h&gt;</code> that return floating-point
  73. results (C90, C99 and C11 5.2.4.2.2).</cite>
  74. <p>The accuracy is unknown.
  75. </p>
  76. </li><li> <cite>The rounding behaviors characterized by non-standard values
  77. of <code>FLT_ROUNDS</code>
  78. (C90, C99 and C11 5.2.4.2.2).</cite>
  79. <p>GCC does not use such values.
  80. </p>
  81. </li><li> <cite>The evaluation methods characterized by non-standard negative
  82. values of <code>FLT_EVAL_METHOD</code> (C99 and C11 5.2.4.2.2).</cite>
  83. <p>GCC does not use such values.
  84. </p>
  85. </li><li> <cite>The direction of rounding when an integer is converted to a
  86. floating-point number that cannot exactly represent the original
  87. value (C90 6.2.1.3, C99 and C11 6.3.1.4).</cite>
  88. <p>C99 Annex F is followed.
  89. </p>
  90. </li><li> <cite>The direction of rounding when a floating-point number is
  91. converted to a narrower floating-point number (C90 6.2.1.4, C99 and C11
  92. 6.3.1.5).</cite>
  93. <p>C99 Annex F is followed.
  94. </p>
  95. </li><li> <cite>How the nearest representable value or the larger or smaller
  96. representable value immediately adjacent to the nearest representable
  97. value is chosen for certain floating constants (C90 6.1.3.1, C99 and C11
  98. 6.4.4.2).</cite>
  99. <p>C99 Annex F is followed.
  100. </p>
  101. </li><li> <cite>Whether and how floating expressions are contracted when not
  102. disallowed by the <code>FP_CONTRACT</code> pragma (C99 and C11 6.5).</cite>
  103. <p>Expressions are currently only contracted if <samp>-ffp-contract=fast</samp>,
  104. <samp>-funsafe-math-optimizations</samp> or <samp>-ffast-math</samp> are used.
  105. This is subject to change.
  106. </p>
  107. </li><li> <cite>The default state for the <code>FENV_ACCESS</code> pragma (C99 and C11
  108. 7.6.1).</cite>
  109. <p>This pragma is not implemented, but the default is to &ldquo;off&rdquo; unless
  110. <samp>-frounding-math</samp> is used in which case it is &ldquo;on&rdquo;.
  111. </p>
  112. </li><li> <cite>Additional floating-point exceptions, rounding modes, environments,
  113. and classifications, and their macro names (C99 and C11 7.6, C99 and
  114. C11 7.12).</cite>
  115. <p>This is dependent on the implementation of the C library, and is not
  116. defined by GCC itself.
  117. </p>
  118. </li><li> <cite>The default state for the <code>FP_CONTRACT</code> pragma (C99 and C11
  119. 7.12.2).</cite>
  120. <p>This pragma is not implemented. Expressions are currently only
  121. contracted if <samp>-ffp-contract=fast</samp>,
  122. <samp>-funsafe-math-optimizations</samp> or <samp>-ffast-math</samp> are used.
  123. This is subject to change.
  124. </p>
  125. </li><li> <cite>Whether the &ldquo;inexact&rdquo; floating-point exception can be raised
  126. when the rounded result actually does equal the mathematical result
  127. in an IEC 60559 conformant implementation (C99 F.9).</cite>
  128. <p>This is dependent on the implementation of the C library, and is not
  129. defined by GCC itself.
  130. </p>
  131. </li><li> <cite>Whether the &ldquo;underflow&rdquo; (and &ldquo;inexact&rdquo;) floating-point
  132. exception can be raised when a result is tiny but not inexact in an
  133. IEC 60559 conformant implementation (C99 F.9).</cite>
  134. <p>This is dependent on the implementation of the C library, and is not
  135. defined by GCC itself.
  136. </p>
  137. </li></ul>
  138. <hr>
  139. <div class="header">
  140. <p>
  141. Next: <a href="Arrays-and-pointers-implementation.html#Arrays-and-pointers-implementation" accesskey="n" rel="next">Arrays and pointers implementation</a>, Previous: <a href="Integers-implementation.html#Integers-implementation" accesskey="p" rel="prev">Integers implementation</a>, Up: <a href="C-Implementation.html#C-Implementation" accesskey="u" rel="up">C Implementation</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  142. </div>
  143. </body>
  144. </html>