Formatted numeric output: Difference between revisions
Content added Content deleted
(Added Quackery.) |
(Added Quackery.) |
||
Line 1,914: | Line 1,914: | ||
=={{header|Quackery}}== |
=={{header|Quackery}}== |
||
<syntaxhighlight lang="Quackery"> |
<syntaxhighlight lang="Quackery"> |
||
[ over find swap found ] is has ( $ c --> b ) |
|||
[ over 0 peek |
|||
char - = iff |
char - = iff |
||
[ 1 - |
[ 1 - |
||
Line 1,924: | Line 1,927: | ||
swap join |
swap join |
||
swap if |
swap if |
||
[ char - swap join ] ] is left-pad ( $ n --> $ ) |
[ char - swap join ] ] is left-pad ( $ n --> $ ) |
||
[ over char . has not if |
|||
[ dip [ char . join ] ] |
|||
over char . swap find |
|||
dip [ over size ] |
|||
1+ - - |
|||
char 0 swap of |
|||
join ] is right-pad ( $ n --> $ ) |
|||
[ dip left-pad right-pad ] is format ( $ n n --> $ ) |
|||
' [ $ "7.125" |
' [ $ "7.125" |
||
$ "-7.125" |
$ "-7.125" |
||
$ "0.125" |
$ "0.125" |
||
$ "-0. |
$ "-0.12" |
||
$ "7.12" |
|||
$ "-7.12" |
|||
$ "0.12" |
|||
$ "-0.12" |
|||
$ "7" |
$ "7" |
||
$ "-7" |
$ "-7" |
||
$ "0" ] |
$ "0" ] |
||
witheach |
witheach |
||
[ do 5 |
[ do 5 3 format echo$ cr ]</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 1,941: | Line 1,958: | ||
-0007.125 |
-0007.125 |
||
00000.125 |
00000.125 |
||
-0000. |
-0000.120 |
||
00007 |
00007.120 |
||
-0007 |
-0007.120 |
||
00000 |
00000.120 |
||
-0000.120 |
|||
00007.000 |
|||
-0007.000 |
|||
00000.000</pre> |
|||
=={{header|R}}== |
=={{header|R}}== |