Integer Arithmetic
The tools on this page implement algorithms for integer arithmetic and consider besides radix-B and B-complement numbers also signed digit numbers and Residue Number Systems (RNS) for more efficient parallel computations.
Base Conversion of Radix-B and B-Complement Numbers
This tool converts a given radix-B or B-complement number for some base oldB to a new base newB. The digits of the number should be written as decimal numbers and have to be separated by "." in case of radices greater than 10.
Radix-B and B-Complement Algorithms
This tool provides basic radix-B and B-complement arithmetic operations. The two operands given refer to selected base (radix) B given. The names of radix-B algorithms are prefixed with "Nat" and the names of B-complement algorithms are prefixed with "Int".
Radix-B Circuit Generators
This tool generates gate-level implementations of some radix-2 arithmetic circuits. To that end, you have to select a circuit and provide inputs as bitvectors. The tool will then generate the general circuit and will simulate it with the given input vectors.
Radix-B and B-Complement Circuit Verification
This tool verifies a given gate-level implementation of an arithmetic circuit. You can select the specification that should be checked, and the tool will then check the correctness of the circuit. It will either report that the circuit is correct or it will list counterexamples where it will not compute the correct results. The following gates can be used to implement a circuit:
- y = AND(x1,x2) implements y = x1∧x2
- y = XOR(x1,x2) implements y = x1⊕x2
- y = OR(x1,x2) implements y = x1∨x2
- (c,s) = HA(x1,x2) implements c = x1∧x2 and s = x1⊕x2
- (c,s) = FA(x1,x2,x3) implements c = x1∧x2∨x3∧(x1⊕x2) and s = x1⊕x2⊕x3
- (g,p) = PG(g1,p1,g2,p2) implements g = g2∨(p2∧g1) and p = p2∧p1
- y = MX(c,x0,x1) implements y = (c?x1:x0)
- (y0,y1) = SW(c,x0,x1) implements y0 = (c?x1:x0) and y1 = (c?x0:x1)
Residue Number Systems
RNS numbers are tuples of integers (x[0],...,x[n-1]) that refer to a base tuple (prime[0],...,prime[n-1]) of pairwise relatively prime numbers such that the represented number x is represented by x[i] := x mod p[i]. Addition, subtraction, multiplication, and equality testing can be done componentwise on these tuples in the representation chosen for these. Testing for the sign and division is however not directly possible. The tool below does not consider these operations, and just considers the decoding of given RNS numbers, i.e., their conversion into signed radix-10 numbers (all inputs are assumed to be given as signed radix-10 numbers).
Schönhage-Strassen Multiplication
Schönhage-Strassen multiplication was the first quasilinear algorithm for multiplication of radix-B numbers. It is based on a special Fast Fourier transform that works on a ring modulo 22n+1 and perform the multiplication of n-bit radix-B numbers in sequential time O(n*log(n)*log(log(n))). It can be easily implemented as PRAM algorithm that runs in parallel time O(log(n)) with work O(n*log(n)*log(log(n))). While the algorithm was developed in 1971, there were no improvements until 2007, where Fürer, and then De/Saha/Kurur/Saptharishi improved it to O(n*log(n)*log*(n)). Further improvements were presented in 2015-2018 by Covanov/Thomé and Harvey/van der Hoeven/Lecerf to O(n*log(n)*22log*(n)).