echo Here is a set of tests of the update of modular arithmetic routines. echo Before each execution output is a copy of the input file. echo Some of these inputs are intentionally pathological, in order to test echo obscure cases for the algorithms. echo "" echo Where possible, these results have been compared against the output echo of the Unix /dc/ \(desktop calculator\) program which can handle echo arbitrary precision math. There was always agreement. /dc/ can not echo handle exponentiation of such large numbers since its results are not echo modular, so the number of digits would be too large to fit into any echo computer. However, other tests of exponentiation were run aside from echo those printed here, and all of the the numbers that /dc/ could handle echo agreed with the results of this program. echo "" echo Note that the updated /division/ routine should really be called echo /inversion/ since it gives number which are neither the quotient nor echo the remainder of a true division operation, but it does give a number echo that yields unity when multiplied by another number, so those two echo numbers are inverse pairs of each other. Modular inversion is not echo present in the 'dc' program. However, a simple check is possible: echo After finding the inverse of a number, the two numbers can be echo multiplied by each other \(both with /dc/ and with the NumberT echo algorithms\) to see if the result gives the Greatest Common echo Denominator fo those two numbers. If so, then the numbers are inverse echo pairs. As you will note in the following results, that it always the echo case, so this demonstrates that the algorithm is working correctly echo for the cases presented here. Also note the subtlety that an echo /inverse/ can only exist if the GCD of the number and the modulus is echo 1. If the GCD is not 1 then the /inverse/ does not exist. However, echo in that case, a number is found to be what you can think of as the echo analogy to the inverse, which I will call the pseudo-inverse. In echo that case, the original number multiplied by the pseudo-inverse echo should give the GCD. In these, tests, that is always the case. echo "" echo "" echo "---------- arith n0 ----------" echo Should fail because input file is empty. echo echo "-begin input file-" cat n0 echo "-end input file-" echo "" arith n0 echo "" echo "" echo "---------- arith n1 ----------" echo Simple test using very small numbers. echo echo "-begin input file-" cat n1 echo "-end input file-" echo "" arith n1 echo "" echo "" echo "---------- arith n2 ----------" echo Another simple test. echo echo "-begin input file-" cat n2 echo "-end input file-" echo "" arith n2 echo "" echo "" echo "---------- arith n3 ----------" echo Test where one of the input numbers equals the modulus, which echo means that its value ends up being zero. echo echo "-begin input file-" cat n3 echo "-end input file-" echo "" arith n3 echo "" echo "" echo "---------- arith n4 ----------" echo Fairly large numbers. echo echo "-begin input file-" cat n4 echo "-end input file-" echo "" arith n4 echo "" echo "" echo "---------- arith n5 ----------" echo "-begin input file-" cat n5 echo "-end input file-" echo "" arith n5 echo "" echo "" echo "---------- arith n6 ----------" echo "-begin input file-" cat n6 echo "-end input file-" echo "" arith n6 echo "" echo "" echo "---------- arith n7 ----------" echo More typical numbers. echo "-begin input file-" cat n7 echo "-end input file-" echo "" arith n7