**PT vectors** are a method for approximately storing large numbers based on power towers. It is employed in Hypercalc.

## Description Edit

A PT vector [*p*,*v*] consists of a nonnegative integer *p* and a floating-point number *v*. The numerical interpretation of this vector is

\[ [p,v] = \text{sgn}(v) \cdot (10 \uparrow 10 \uparrow \cdots \uparrow 10 \uparrow |v|)\]

where there are *p* copies of 10.

PT vectors are normalized so that |*v*| is in a comfortable range. Hypercalc restricts \(\log_{10} 300 \leq |v| \leq 10^{300}\), allowing \(|v| < \log_{10} 300\) if \(p = 0\).

From here, standard operations on PT vectors may be defined. The general principle is that PT vector operations use *casework* to deal with small values and *estimation* to deal with large values. It helps to look at an example — addition of two positive PT vectors. One very useful assumption we can make: when *a* and *b* are large enough, *a* + *b* = max(*a*, *b*). For smaller *a* and *b*, the cases can be handled more exactly:

- \([0, v] + [0, w] = [0, v + w]\)
- \([0, v] + [1, w] = [1, \log_{10}(10^{\log_{10}(v) - w} + 1) + w]\)
- \([1, v] + [1, w] = [1, \log_{10}(10^{v - w} + 1) + w]\)

This same principle applies to other operators. A factorial implementation, for example, would use direct computation for small values, Stirling's approximation for medium sized values, and a rough approximation such as *x*! = 10^{x} for very large values.