toolchain/share/doc/as.html/Flonums.html

100 lines
4.5 KiB
HTML
Raw Permalink Normal View History

2024-01-10 05:24:32 +00:00
<html lang="en">
<head>
<title>Flonums - Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Numbers.html#Numbers" title="Numbers">
<link rel="prev" href="Bignums.html#Bignums" title="Bignums">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU Assembler "as".
Copyright (C) 1991-2019 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Flonums"></a>
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Bignums.html#Bignums">Bignums</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Numbers.html#Numbers">Numbers</a>
<hr>
</div>
<h5 class="subsubsection">3.6.2.3 Flonums</h5>
<p><a name="index-flonums-183"></a><a name="index-floating-point-numbers-184"></a><a name="index-constants_002c-floating-point-185"></a>
<a name="index-precision_002c-floating-point-186"></a>A <dfn>flonum</dfn> represents a floating point number. The translation is
indirect: a decimal floating point number from the text is converted by
<samp><span class="command">as</span></samp> to a generic binary floating point number of more than
sufficient precision. This generic floating point number is converted
to a particular computer's floating point format (or formats) by a
portion of <samp><span class="command">as</span></samp> specialized to that computer.
<p>A flonum is written by writing (in order)
<ul>
<li>The digit &lsquo;<samp><span class="samp">0</span></samp>&rsquo;.
(&lsquo;<samp><span class="samp">0</span></samp>&rsquo; is optional on the HPPA.)
<li>A letter, to tell <samp><span class="command">as</span></samp> the rest of the number is a flonum.
<kbd>e</kbd> is recommended. Case is not important.
<p>On the H8/300 and Renesas / SuperH SH architectures, the letter must be
one of the letters &lsquo;<samp><span class="samp">DFPRSX</span></samp>&rsquo; (in upper or lower case).
<p>On the ARC, the letter must be one of the letters &lsquo;<samp><span class="samp">DFRS</span></samp>&rsquo;
(in upper or lower case).
<p>On the HPPA architecture, the letter must be &lsquo;<samp><span class="samp">E</span></samp>&rsquo; (upper case only).
<li>An optional sign: either &lsquo;<samp><span class="samp">+</span></samp>&rsquo; or &lsquo;<samp><span class="samp">-</span></samp>&rsquo;.
<li>An optional <dfn>integer part</dfn>: zero or more decimal digits.
<li>An optional <dfn>fractional part</dfn>: &lsquo;<samp><span class="samp">.</span></samp>&rsquo; followed by zero
or more decimal digits.
<li>An optional exponent, consisting of:
<ul>
<li>An &lsquo;<samp><span class="samp">E</span></samp>&rsquo; or &lsquo;<samp><span class="samp">e</span></samp>&rsquo;.
<!-- I can't find a config where "EXP_CHARS" is other than 'eE', but in -->
<!-- principle this can perfectly well be different on different targets. -->
<li>Optional sign: either &lsquo;<samp><span class="samp">+</span></samp>&rsquo; or &lsquo;<samp><span class="samp">-</span></samp>&rsquo;.
<li>One or more decimal digits.
</ul>
</ul>
<p>At least one of the integer part or the fractional part must be
present. The floating point number has the usual base-10 value.
<p><samp><span class="command">as</span></samp> does all processing using integers. Flonums are computed
independently of any floating point hardware in the computer running
<samp><span class="command">as</span></samp>.
</body></html>