Formatted numeric output: Difference between revisions

Content added Content deleted
m (→‎{{header|APL}}: Regularize non-standard header markup)
(Replaced module "strfmt" by the more convenient "strformat" which is now provided by the standard library.)
Line 1,426: Line 1,426:


=={{header|Nim}}==
=={{header|Nim}}==
<lang nim>import strfmt
<lang nim>import strformat
const r = 7.125
const r = 7.125
echo r
echo r
echo((-r).format("9.3f"))
echo fmt"{-r:9.3f}"
echo(r.format("9.3f"))
echo fmt"{r:9.3f}"
echo((-r).format("09.3f"))
echo fmt"{-r:09.3f}"
echo(r.format("09.3f"))</lang>
echo fmt"{r:09.3f}"</lang>
{{out}}
{{out}}
<pre>7.1250000000000000e+00
<pre>7.125
-7.125
-7.125
7.125
7.125