Debian Codegraph @

docs/manual/_fixed-S_.html

raw
1 <html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
2 <title>fixed$</title>
3 <style>
4 td { padding-left: 5pt; padding-right: 5pt; }
5 th { padding-left: 5pt; padding-right: 5pt; }
6 code { white-space: pre-wrap; }
7 dd { white-space: pre-wrap; }
8 </style>
9 </head><body bgcolor="#FFFFFF">
10
11 <table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Monaco,Courier" size=6 color="#999900"><b>
12 fixed$
13 </b></font></table></table>
14 <p>A function that can be used in <a href="Formulas.html">Formulas</a>.</p>
15 <h2>Syntax and semantics</h2>
16 <dl>
17 <dt><b><code><font size=+1>fixed$</font></code></b> (<i><code><font size=+1>number</font></code></i>, <i><code><font size=+1>precision</font></code></i>)
18 <dd>format a number as a string, with <i><code><font size=+1>precision</font></code></i> digits after the decimal point.</dd>
19 <dt><b><code><font size=+1>fixed$</font></code></b> (<i><code><font size=+1>vector#</font></code></i>, <i><code><font size=+1>precision</font></code></i>)
20 <dd>format a vector as a string, with all elements expressed in <i><code><font size=+1>precision</font></code></i> digits after the decimal point.</dd>
21 <dt><b><code><font size=+1>fixed$</font></code></b> (<i><code><font size=+1>matrix##</font></code></i>, <i><code><font size=+1>precision</font></code></i>)
22 <dd>format a matrix as a string, with all cells expressed in <i><code><font size=+1>precision</font></code></i> digits after the decimal point.</dd>
23 </dl>
24 <h2>Examples</h2>
25 <code> assert fixed$ (pi, 3) = "3.142"<br></code>
26 <code> assert fixed$ (-1, 3) = "-1.000"<br></code>
27 <code> assert fixed$ (1e6, 3) = "1000000.000"<br></code>
28 <code> assert fixed$ (0.01, 3) = "0.010"<br></code>
29 <code> assert fixed$ (0.001, 3) = "0.001"<br></code>
30 <code> assert fixed$ (0.0001, 3) = "0.0001" ; never less than 1 significant digit!<br></code>
31 <code> <br></code>
32 <code> assert fixed$ ({ pi, -1, 1e6, 0.0001 }, 3) =<br></code>
33 <code> ... "3.142" + newline$ + "-1.000" + newline$ +<br></code>
34 <code> ... "1000000.000" + newline$ + "0.0001" + newline$<br></code>
35 <h3>Links to this page</h3>
36 <ul>
37 <li><a href="_clock_.html"><code><font size=+1>clock</font></code></a>
38 <li><a href="energy_integration_continuity_test.html">energy integration continuity test</a>
39 <li><a href="Functions.html">Functions</a>
40 <li><a href="Scripting_5_1__Variables.html">Scripting 5.1. Variables</a>
41 <li><a href="What_was_new_in_4_0_.html">What was new in 4.0?</a>
42 <li><a href="What_s_new_.html">What's new?</a>
43 </ul>
44 <hr>
45 <address>
46 <p>© Paul Boersma 2023,2025</p>
47 </address>
48 </body>
49 </html>