An
open-source calculator program, available as a
perl script, that enables calculation of
large numbers that would
overflow GNU bc,
bignum libraries or any
mortal handheld calculator. It was originally a
PalmPilot program, and you might still find that version if you look hard. It has also been made into a JavaScript version, use
Google and search for "HyperCalc" on site "edu.hk"
It represents numbers in
floating-point notation with as
many as 300 digits, and when the
exponent gets too large, it converts the number to a
logarithm.
Here is an example of using Hypercalc to compute the
factorial of the number of
atoms in the
author's body:
bash$ hypercalc
Go ahead -- just TRY to make me overflow!
_ _
|_| . . ._ _ ._ _ ._ | _
| | | | | ) (-` | ( ,-| | (
~ ~ _7 |~ ~' ~ ~ `~` ~ ~
Enter expressions, or type 'help' for help.
C1 = weight = 102
R1: weight = 102
C2 = atoms = weight x 10^26
R2: atoms = 1.02 x 10 ^ 28
C3 = r2 !
R3: 10 ^ ( 2.8125791803656 x 10 ^ 29 )
C4 = 27^weight^atoms
R4: 10 ^ ( 10 ^ ( 2.0487721751971 x 10 ^ 28 ) )
C5 = 27^42^weight^atoms
R5: 3 PT ( 2.0487721751971 x 10 ^ 28 )
C6 =
In the last result, "3 PT" means "3 powers of 10". It is an
interesting exercise to convince yourself why R5 appears to be the same as 10 to the power of R4.
To find the Hypercalc
source code on the
web, use a
search engine like
Google and search for the string "pt_addpos", or "hypercalc interpreted calculator overflow".
Copyright © 2001-2008 Robert Munafo. Robert Munafo is mrob27.