An infinite-precision calculator and function library for Miranda

Other bignum calculation systems

At least two other arbitrary-precision calculating systems are included in "standard" Unix: bc and perl both of which make you specify the required precision of the result in advance, and both of which make you wait for the whole calculation to complete before they will tell you any digits of the result.


This classic Unix calculator always works with integers of unbounded size. When invoked with the -l option, you can specify the number of decimal places by setting the magic `scale' variable.

For example, to calculate 200 decimal places of "pi" as four times the arctangent of one:

	$ bc -l
	4 * a(1)


Perl has a bignum library which replaces all the regular numerical operators with arbitrary-precision versions, and is documented under the Unix manual page bignum(3). It implements square roots and natural logarithms, but fails to provide substitutes for regular perl's sin, cos and atan2 functions.

To calculate the square root of two to 2000 decimal places, you can say:

	$ perl -Mbignum=p,-2000 -le 'print sqrt 2'
An interesting sister package by the same author is bigrat, which works in, and gives its results as, vulgar fractions. For example:
	$ perl -Mbigrat -le 'print 1/3 + 1/4'
This nicely solves the "sum of three thirds" problem for which bc and perl -Mbignum give .999999999... and which just gives bignum/bigfloat a terminal headache.

Author: Tels,, early 2002.


Martin Guy <>, April 2004