a command-line exact real calculator


spigot is a command-line streaming exact real calculator.

A normal calculating program, given a mathematical expression to evaluate, will want to know in advance how many digits of output are needed (if it even has that option), and if the expression includes more than one successive operation, then rounding errors will build up so that the last few digits are potentially wrong, or perhaps more in some cases (e.g. if significance loss occurs).

spigot, by contrast, does not output any digit of the answer until it's sure that the digit is right, and it will keep generating digits until you tell it to stop.

Also, spigot is ‘streaming’ in the sense that if you tell it to do computations on a number you've previously stored in a file (perhaps to very high precision) or a number it's reading from a pipe, then it will begin producing output as soon as it's read enough of the input to know how the output starts.

The downside is that spigot is very slow compared to the usual kind of computer arithmetic. But it can be useful if you really need a lot of digits for some reason (e.g. a large number of digits of mathematical constants are sometimes incorporated into cryptographic algorithms), or as a cross-check on other calculating systems.

For more information, read the manual online, which includes some examples of the sort of thing spigot can do.

spigot is named after its core algorithm, which is Jeremy Gibbons's unbounded spigot algorithm for the digits of π, enhanced to support more output modes and a lot more input numbers.


spigot is distributed under the MIT licence, so it is free to copy, redistribute, use and reuse.

For more details, see the file called LICENCE in the distribution archive, or the licence appendix in the documentation.


A Unix source archive of spigot is available here:


spigot can run on Windows too. A pre-compiled Windows executable is here:


If you want to see the latest state of development, you can check the development sources out from my git repository:

git clone https://git.tartarus.org/simon/spigot.git

Alternatively, you can browse the repository on the web, here.


Please report bugs to anakin@pobox.com.

You might find it helpful to read this article before reporting a bug.

Patches are welcome.

(comments to anakin@pobox.com)
(thanks to chiark for hosting this page)
(last modified on Sun Mar 19 02:42:37 2017)