Very Large Unsigned (VLU) Integer Arithmatic

Description of VLU numbers.

  The digits are base 65536 (2^16). Each digit is an element in a dword array. The least significant digit (right most) is the element value times 655360. The next digit to the left is the value times 655361, next after that is value times 655362, and so on. With 63 digits, that is 1008 bits; and the array can have many more digits. Using zero based element indexing, the indexes and exponents are the same number. The word size of a VLU digit in dwords allows keeping carry bits. Worst case carry is hFFFF times hFFFF equals hFFFE0001, which is 32bits. The upper 16 bits are added to the next digit then masked out (carried).

  For now VLU is coded for PowerBASIC, a 32 bit compiler. With the algorithms worked out, changing variable size is easy.

Arithmatic Operations Implemented

  There are 5 basic operations:
VLU Addition
VLU Subtraction
VLU Multiplication
VLU Division
VLU Square Root

Support Operations

  When used by the arithmatic operation functions the code here is copied into them. These may also be useful as separate functions, and testing was less complicated.
VLU Trim to MSD
VLU Compare (>, = or <)


Created on 20 December 2021; last edit 20 Dec 2021.