LT4335 integer description.
Version of 8 July 2011.
Home.

The principal integer type on the LT4335 is simply called integers, or sometimes regular integers. Some implementations will have an additional type called extends, which are extended precision integers. However, extends, described elsewhere, work much differently from the regular integers discussed on this page.

The manner of representing (regular) integers is the two's complement method, with one variation: the bit pattern that would otherwise be the most negative value is reserved to mean instead the valueless state, known as null. A principle of the LT4335 machine is this: whenever integer arithmetic is performed, there will never be a silent error. If the CPU cannot provide an answer that is exactly correct, then either the result(s) of the operation will be null, or an exception will be thrown.

The machine does not support an unsigned integer data type. This policy eliminates the subtle problems often encountered in converting between signed and unsigned integers, and is why genspace has both positive and negative addresses. An eight-bit unsigned integer is sometimes used to represent the size of data, as in a meta-register, but no calculations can be performed with this number. Within the opcodes of some instructions appear signed or unsigned integers, but these too are unavailable for manipulation. The LT4335 provides no support for a program that attempts to alter such an integer appearing as part of an opcode, as the machine is not intended for self-modifying programs.

While integers may be implemented with anywhere from 0 to 255 bits, 4 are enough for a good example. As usual in this report, the least significant bit is written first:

four bitsequivalent  four bitsequivalent
0001null00000
1001−71000+1
0101−60100+2
1101−51100+3
0011−40010+4
1011−31010+5
0111−20110+6
1111−11110+7

The table shows that a four-bit integer has 16 states, but only 15 of them are values, and that values are symmetrically arranged around zero.

Within the CPU, the 255 bits within a register are numbered 0…255. The least significant bit of an integer is stored in location 0, the next-to-least significant at location 1, et cetera. The meta-register, which invariably contains an eight-bit unsigned integer, tells how many of the register bits are in use. A meta-register may be copied to a (regular) register, where it becomes a signed integer, assuredly nonnegative, that is anywhere from one to nine bits.

Many integers can be represented more than one way. For instance the number nine might be encoded into a register as B10010 (with the meta-register equalling 5), 100100 (meta = 6), 1001000 (meta = 7), 1001_0000_0000 (meta = 12), et cetera. When the CPU writes an integer to a register as the result of a calculation, it will ordinarily be trimmed, meaning that the shortest legal representation will be used. This is intended to speed subsequent calculations, as the CPU will then be able to examine the minimum quantity of digits in finding the answer. To benefit programmers who need to construct integers bit by bit, the CPU will read any of the correct representations. Also, there is an instruction to force an integer to a wider-than-minimal representation.

The following table shows what integers can be stored in what quantities of bits:

quantity
of bits
largest integersmallest integernull
binarydecimalbinarydecimalbinary
0none noneφ
100 001
210+1 11−101
3110+3 101−3001
41110+7 1001−70001
511110 +15 10001−1500001
6111110 = 150+31 100001 = 1041−31000001 = 051
7160+63 1051−63061
8170+127 1061−127071
n (max 255) 1n−10+(2**(n−1) − 1) 10n−21−(2**(n−1) − 1) 0n−11

For instance, in 5 bits, the largest integer that can be stored is B11110 = +15 and the smallest is 10001 = −15. Null is 00001.

Two integers are similar if both are null, or neither is null. Consequently, they are dissimilar if one is null but the other has a value. A zero-bit integer is always null. A one-bit integer, which is either zero or null, might be used as a boolean variable, although a one-bit string may work better.

The extreme integers are ±(2**254 − 1) ≈ ±2.9 × 10**76, but the extreme addresses of genspace are only ±(2**253 − 1). This ensures that if one valid address is subtracted from another, the integer result does not overflow. Some powers of two are listed here.