Stackermann: Difference between revisions
(Created page with "{{lowercase}} '''stackermann''' is a program that calculates the w:Ackermann function. It utilises [http://gmplib.org/ GMP] in conjunction with a simplistic stack data-ty...") |
m (→Normal usage) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
'''stackermann''' is a program that calculates the [[w:Ackermann function|Ackermann function]]. It utilises [http://gmplib.org/ GMP] in conjunction with a simplistic stack data-type to calculate the enormous values efficiently. | '''stackermann''' is a program that calculates the [[w:Ackermann function|Ackermann function]]. It utilises [http://gmplib.org/ GMP] in conjunction with a simplistic stack data-type to calculate the enormous values efficiently. | ||
=Dependencies= | |||
* UNIX-like system (probably includes Cygwin; not tested, though.) | * UNIX-like system (probably includes Cygwin; not tested, though.) | ||
* ≥ gmp-4.0 | * ≥ gmp-4.0 | ||
Line 11: | Line 8: | ||
Additionally, accurate computation timing requires librt; this is used by default and is present on just about any sane system. | Additionally, accurate computation timing requires librt; this is used by default and is present on just about any sane system. | ||
=Obtaining stackermann= | |||
stackermann is available as a source tarball at http://proj.penguindevelopment.org/stackermann/. [http://proj.penguindevelopment.org/stackermann/stackermann-latest.tar.gz Direct link to the latest version.] | stackermann is available as a source tarball at http://proj.penguindevelopment.org/stackermann/. [http://proj.penguindevelopment.org/stackermann/stackermann-latest.tar.gz Direct link to the latest version.] | ||
Installation follows the usual configure/make/make install procedure. | Installation follows the usual configure/make/make install procedure. | ||
=Quick overview= | |||
==Normal usage== | |||
Given ''m'' and ''n'', stackermann simply calculates the value and prints it to stdout: | Given ''m'' and ''n'', stackermann simply calculates the value and prints it to stdout: | ||
<pre>$ stackermann 4 1 | <pre>$ stackermann 4 1 | ||
A(4, 1)=65533</pre> | A(4, 1)=65533</pre> | ||
Use the <tt>-t</tt> option to suppress the leading ''A(m, n)='':<pre>$ stackermann 4 1 | Use the <tt>-t</tt> option to suppress the leading ''A(m, n)='':<pre>$ stackermann -t 4 1 | ||
65533</pre> | 65533</pre> | ||
If ''n'' is not given, ''n=m'' is assumed:<pre>$stackermann 3 | If ''n'' is not given, ''n=m'' is assumed:<pre>$ stackermann 3 | ||
A(3, 3)=61</pre> | A(3, 3)=61</pre> | ||
The <tt>-s</tt> option may be used to additionally print computation statistics to stderr:<pre>$ stackermann -s 3 | The <tt>-s</tt> option may be used to additionally print computation statistics to stderr:<pre>$ stackermann -s 3 | ||
Line 30: | Line 27: | ||
8 stack ops; max stack size 4 (~72 bytes).</pre> | 8 stack ops; max stack size 4 (~72 bytes).</pre> | ||
==Benchmark mode== | |||
In benchmark mode (the <tt>-b</tt> option), stackermann does not print the calculated value at all; instead, it prints statistics on what it took to calculate it. The output produced is printed as a space-separated list | In benchmark mode (the <tt>-b</tt> option), stackermann does not print the calculated value at all; instead, it prints statistics on what it took to calculate it. The output produced is printed as a space-separated list of—respectively—total computation time in seconds, total number of stack pushes, maximum number of stack entries, and approximate maximum stack size in bytes. | ||
<pre>$ stackermann -b 4 2 | <pre>$ stackermann -b 4 2 | ||
0.050 131103 65534 1048552</pre> | 0.050 131103 65534 1048552</pre> | ||
==Additional options== | |||
For an up-to-date overview of all available options and features, see the manpage included in the source tarball. | For an up-to-date overview of all available options and features, see the manpage included in the source tarball. | ||
=Limitations, bugs and feedback= | |||
==Limitations== | |||
To improve efficiency, stackermann does not allow the ''m''-parameter to be greater than 255. In reality, this is unlikely to pose a problem, since no current computer will have the memory or speed required to compute the values with high ''m''-parameters anyway. ''This is not a bug; do NOT report it as one!'' | |||
==Bugs and feedback== | |||
{{bugs and feedback}} | |||
[[Category:Software]] | [[Category:Software]] |
Latest revision as of 11:30, 17 September 2013
stackermann is a program that calculates the Ackermann function. It utilises GMP in conjunction with a simplistic stack data-type to calculate the enormous values efficiently.
Dependencies
- UNIX-like system (probably includes Cygwin; not tested, though.)
- ≥ gmp-4.0
Additionally, accurate computation timing requires librt; this is used by default and is present on just about any sane system.
Obtaining stackermann
stackermann is available as a source tarball at http://proj.penguindevelopment.org/stackermann/. Direct link to the latest version.
Installation follows the usual configure/make/make install procedure.
Quick overview
Normal usage
Given m and n, stackermann simply calculates the value and prints it to stdout:
$ stackermann 4 1 A(4, 1)=65533
Use the -t option to suppress the leading A(m, n)=:
$ stackermann -t 4 1 65533
If n is not given, n=m is assumed:
$ stackermann 3 A(3, 3)=61
The -s option may be used to additionally print computation statistics to stderr:
$ stackermann -s 3 A(3, 3)=61 Processing time: 0.001 s. 8 stack ops; max stack size 4 (~72 bytes).
Benchmark mode
In benchmark mode (the -b option), stackermann does not print the calculated value at all; instead, it prints statistics on what it took to calculate it. The output produced is printed as a space-separated list of—respectively—total computation time in seconds, total number of stack pushes, maximum number of stack entries, and approximate maximum stack size in bytes.
$ stackermann -b 4 2 0.050 131103 65534 1048552
Additional options
For an up-to-date overview of all available options and features, see the manpage included in the source tarball.
Limitations, bugs and feedback
Limitations
To improve efficiency, stackermann does not allow the m-parameter to be greater than 255. In reality, this is unlikely to pose a problem, since no current computer will have the memory or speed required to compute the values with high m-parameters anyway. This is not a bug; do NOT report it as one!
Bugs and feedback
Report bugs via email at bugs[at]proj[dot]penguindevelopment[dot]org.
Send your feedback to feedback[at]proj[dot]penguindevelopment[dot]org.