High-Precision Arithmetic - Calculation of Euler's Number e to Arbitrary Number of Significant Digits

Following is an implementation in C++ of a high-precision arithmetic programme for the calculation of Euler's number to an arbirary number of significant digits. The programme can be run in parallel on any number of networked compute nodes that can be logged on to with a single account sharing the same home drive (e.g., an NFS share) across all compute nodes. This programme does not require parallel computing libraries such as MPI, nor is it dependent on OpenMP-aware compilers.

Please note that this programme requires a UNIX-like OS to run. It has been succesfully tested on Free BSD 6, RH Linux 9, RHEL 3, Red Hat Fedora Core 3-5.

Download the following file, save it under the name e.tar.bz2, extract all files into the same folder using a tar/bzip2-compatible decompression utility - e.g., decompress using tar xfj e.tar.bz2. Once all the files have been decompressed and placed into the same folder, make the code using make e and make longadd (on an x86 Solaris OS, rename Makefile-sol-x86 into Makefile before making the code).

The main execution file is a Perl script calce.pl. Invoke this script with parameter -h to learn a detailed invokation syntax for this programme.

The required number of significant digits can supplied to calce.pl in the command-line option -d 4-100000000. By default, the programme will compute 100 decimal digits.

The list of compute nodes (ip addresses or host names) can be placed in the ehosts.txt file. If a different host file is used, its name should be supplied to calce.pl after the command line option -f (followed by space).

By default, calce.pl uses ssh -x command for running partial computation programmes on remote nodes. This bahaviour can be overridden with the -exec command-line option of calce.pl.

If -l 1 command-line option is specified, a log file calce.log is produced. The log file name can be overridden with the option -lf . Verbose output is switched on by the option -v 1.

full paths to the partial calculation programme that runs on each node and the result summation program that is invoked on the host where calce.pl script is running can be specified with -p "pathspec" and -la "pathspec" command-line options. By default, "./e" and "./longadd" are expanded and invoked on all compute nodes and the host running calce.pl, respectively. Alternative programme paths are useful when running parallel computations across different platforms (in which case the path to the partial calculation programme would be a local filesystem path).

The programme creates temporary files in the user home directory named "computenode_temp_x" that are not removed after the calculations have been completed, and the result is placved in the file "e_with_number_dec_places" in the directory where calce.pl resides.

The programme has been coded in C++ and some of computational efficiency was inevitably bargained for lucidity, however its ability to take advantage of an arbitrary number of compute nodes across different UNIX-like platforms offsets the disadvantage of C++ overhead.

If ssh is used for remote command execution (as is the default setting), the ssh agent should be set up to allow passwordless login, otherwise the remote scripts will stop until the user manually enters the password. The username that runs the remote execution commands can be specified in the -u username option.

The supplied longmath.* files contain a high-precision arithmetic C++ class library that can be used in other applications subject to the terms of the license agreement provided in the source code.