Stackermann: Difference between revisions

From Penguin Development
Jump to navigationJump to search
m (Changed section headers to primary.)
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.


==Limitations==
=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.
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.


==Dependencies==
=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 11:
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==
=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==
=Quick overview=
===Normal usage===
==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
Line 30: Line 30:
8 stack ops; max stack size 4 (~72 bytes).</pre>
8 stack ops; max stack size 4 (~72 bytes).</pre>


===Benchmark mode===
==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 of—respectively—total computation time in seconds, total number of stack pushes, maximum number of stack entries, and approximate maximum stack size in bytes.
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===
==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.


[[Category:Software]]
[[Category:Software]]

Revision as of 02:54, 17 August 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.

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.

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 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.