Bignum

An infinite-precision calculator and function library for Miranda and type for Haskell

Introduction

There are many arithmetical packages available to perform scientific calculations to frightening precision but, without exception, you have to specify the required precision (usually a fixed number of decimal places) before starting the calculation, with the unfortunate side-effect that the last few places of a result of a complicated calculation are not reliable, depending as they do on the precision of intermediate results. Consequently, such an apparently super-precise result can in fact be misleading, and a rigorous study of the precision lost in intermediate calculations is required to be able to determine how many digits of the result are sure to be correct.

This calculator is different. It evaluates to a depth such that it is always certain that the digits of the results that it prints are correct, with no rounding or intermediate errors. To obtain a result to a certain number of figures it is sufficient to discard all the figures that are not required. In its native form, the calculator outputs an infinite number of digits, limited only by the amount of physical memory available on the host machine, which is a product of the complexity of the calculation in progress.

It works by doing the minimum amount of carry-lookahead required to be certain of the next digit it must print. The syntax in which expressions are entered is currently horrendous, since it consists of calls to functions written in the Miranda functional programming language; it requires a normal infix parser to accept the usual syntax for formulae. That said, it is usable.


Martin Guy <martinwguy@gmail.com>, Canterbury 1989 - Catania 2001 - Newcastle 2005.
Last modified: 2 January 2006