summaryrefslogtreecommitdiff
path: root/devdocs/elisp/numbers.html
blob: 7f23345f307c88e1a3c17313ae6ec031a76ab194 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 <h2 class="chapter">Numbers</h2>   <p>GNU Emacs supports two numeric data types: <em>integers</em> and <em>floating-point numbers</em>. Integers are whole numbers such as -3, 0, 7, 13, and 511. Floating-point numbers are numbers with fractional parts, such as -4.5, 0.0, and 2.71828. They can also be expressed in exponential notation: ‘<samp>1.5e2</samp>’ is the same as ‘<samp>150.0</samp>’; here, ‘<samp>e2</samp>’ stands for ten to the second power, and that is multiplied by 1.5. Integer computations are exact. Floating-point computations often involve rounding errors, as the numbers have a fixed amount of precision. </p> <table class="menu" border="0" cellspacing="0"> <tr>
<td align="left" valign="top">• <a href="integer-basics" accesskey="1">Integer Basics</a>
</td>
<td> </td>
<td align="left" valign="top">Representation and range of integers. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="float-basics" accesskey="2">Float Basics</a>
</td>
<td> </td>
<td align="left" valign="top">Representation and range of floating point. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="predicates-on-numbers" accesskey="3">Predicates on Numbers</a>
</td>
<td> </td>
<td align="left" valign="top">Testing for numbers. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="comparison-of-numbers" accesskey="4">Comparison of Numbers</a>
</td>
<td> </td>
<td align="left" valign="top">Equality and inequality predicates. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="numeric-conversions" accesskey="5">Numeric Conversions</a>
</td>
<td> </td>
<td align="left" valign="top">Converting float to integer and vice versa. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="arithmetic-operations" accesskey="6">Arithmetic Operations</a>
</td>
<td> </td>
<td align="left" valign="top">How to add, subtract, multiply and divide. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="rounding-operations" accesskey="7">Rounding Operations</a>
</td>
<td> </td>
<td align="left" valign="top">Explicitly rounding floating-point numbers. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="bitwise-operations" accesskey="8">Bitwise Operations</a>
</td>
<td> </td>
<td align="left" valign="top">Logical and, or, not, shifting. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="math-functions" accesskey="9">Math Functions</a>
</td>
<td> </td>
<td align="left" valign="top">Trig, exponential and logarithmic functions. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="random-numbers">Random Numbers</a>
</td>
<td> </td>
<td align="left" valign="top">Obtaining random integers, predictable or not. </td>
</tr> </table><div class="_attribution">
  <p class="_attribution-p">
    Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
    <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Numbers.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Numbers.html</a>
  </p>
</div>