You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Floating-point-implementation.html 7.4KB

3 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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-2020 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 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Floating point implementation (Using the GNU Compiler Collection (GCC))</title>
  21. <meta name="description" content="Floating point implementation (Using the GNU Compiler Collection (GCC))">
  22. <meta name="keywords" content="Floating point implementation (Using the GNU Compiler Collection (GCC))">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  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.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  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.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Floating-point-implementation"></a>
  62. <div class="header">
  63. <p>
  64. 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>
  65. </div>
  66. <hr>
  67. <a name="Floating-Point"></a>
  68. <h3 class="section">4.6 Floating Point</h3>
  69. <ul>
  70. <li> <cite>The accuracy of the floating-point operations and of the library
  71. functions in <code>&lt;math.h&gt;</code> and <code>&lt;complex.h&gt;</code> that return floating-point
  72. results (C90, C99 and C11 5.2.4.2.2).</cite>
  73. <p>The accuracy is unknown.
  74. </p>
  75. </li><li> <cite>The rounding behaviors characterized by non-standard values
  76. of <code>FLT_ROUNDS</code>
  77. (C90, C99 and C11 5.2.4.2.2).</cite>
  78. <p>GCC does not use such values.
  79. </p>
  80. </li><li> <cite>The evaluation methods characterized by non-standard negative
  81. values of <code>FLT_EVAL_METHOD</code> (C99 and C11 5.2.4.2.2).</cite>
  82. <p>GCC does not use such values.
  83. </p>
  84. </li><li> <cite>The direction of rounding when an integer is converted to a
  85. floating-point number that cannot exactly represent the original
  86. value (C90 6.2.1.3, C99 and C11 6.3.1.4).</cite>
  87. <p>C99 Annex F is followed.
  88. </p>
  89. </li><li> <cite>The direction of rounding when a floating-point number is
  90. converted to a narrower floating-point number (C90 6.2.1.4, C99 and C11
  91. 6.3.1.5).</cite>
  92. <p>C99 Annex F is followed.
  93. </p>
  94. </li><li> <cite>How the nearest representable value or the larger or smaller
  95. representable value immediately adjacent to the nearest representable
  96. value is chosen for certain floating constants (C90 6.1.3.1, C99 and C11
  97. 6.4.4.2).</cite>
  98. <p>C99 Annex F is followed.
  99. </p>
  100. </li><li> <cite>Whether and how floating expressions are contracted when not
  101. disallowed by the <code>FP_CONTRACT</code> pragma (C99 and C11 6.5).</cite>
  102. <p>Expressions are currently only contracted if <samp>-ffp-contract=fast</samp>,
  103. <samp>-funsafe-math-optimizations</samp> or <samp>-ffast-math</samp> are used.
  104. This is subject to change.
  105. </p>
  106. </li><li> <cite>The default state for the <code>FENV_ACCESS</code> pragma (C99 and C11
  107. 7.6.1).</cite>
  108. <p>This pragma is not implemented, but the default is to &ldquo;off&rdquo; unless
  109. <samp>-frounding-math</samp> is used in which case it is &ldquo;on&rdquo;.
  110. </p>
  111. </li><li> <cite>Additional floating-point exceptions, rounding modes, environments,
  112. and classifications, and their macro names (C99 and C11 7.6, C99 and
  113. C11 7.12).</cite>
  114. <p>This is dependent on the implementation of the C library, and is not
  115. defined by GCC itself.
  116. </p>
  117. </li><li> <cite>The default state for the <code>FP_CONTRACT</code> pragma (C99 and C11
  118. 7.12.2).</cite>
  119. <p>This pragma is not implemented. Expressions are currently only
  120. contracted if <samp>-ffp-contract=fast</samp>,
  121. <samp>-funsafe-math-optimizations</samp> or <samp>-ffast-math</samp> are used.
  122. This is subject to change.
  123. </p>
  124. </li><li> <cite>Whether the &ldquo;inexact&rdquo; floating-point exception can be raised
  125. when the rounded result actually does equal the mathematical result
  126. in an IEC 60559 conformant implementation (C99 F.9).</cite>
  127. <p>This is dependent on the implementation of the C library, and is not
  128. defined by GCC itself.
  129. </p>
  130. </li><li> <cite>Whether the &ldquo;underflow&rdquo; (and &ldquo;inexact&rdquo;) floating-point
  131. exception can be raised when a result is tiny but not inexact in an
  132. IEC 60559 conformant implementation (C99 F.9).</cite>
  133. <p>This is dependent on the implementation of the C library, and is not
  134. defined by GCC itself.
  135. </p>
  136. </li></ul>
  137. <hr>
  138. <div class="header">
  139. <p>
  140. 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>
  141. </div>
  142. </body>
  143. </html>