The bignumber unit allows several operations on numbers greater than range of longint, which are represented in memory as strings. It is used in counting greatest common divisor and extended miller test. Sorry for naming functions in Polish, but it was easier for me to compute it in such a way. Following functions are avaible currently:
Name | Vars | Comment |
mstring | TYPE | A record that contains zn - a longint 1 or -1 that indicates a sign, and war - string, the value. |
initialize | NONE | Should be executed before using bignumber unit. |
wch, wlo | longint -> char, char -> longint | Changes longint to char and vice versa. |
przez2 | string,longint -> string | Divides given number in given positional system by 2. |
zmienw2 | string,longint -> string | Changes given number in given positional system into binar. Base of system should be even. |
mn | string,string -> boolean | Gives TRUE if first number is less or equal to the second. |
wyczysc | string -> string | Clears zeros before the number. |
bezkon | string->string | Clears zeros after the number. |
bez | string -> string | Clears the last digit of the number. |
od | string,string -> string | Computes the difference between two binar numbers. First should be greater or equal than second. |
nwduj | string,string->string | Computes greatest common divisor of two binar numbers. Result is also binar. |
modulo | string,string -> string | Computes first string modulo second. Input and output should be binar. |
dod | string,string,longint -> string | Computes sum of two numbers in a given positional system. |
zmien | string,longint -> longint | Changes binar number into other positional system. |
rand | string -> string | Produces random binar number in range from 1 to given in input. |
mul | string,string -> string | Multiplicates two binar numbers. |
poteg | string,string,string -> string | Computes (a^b) mod c wher a,b,c are input. Input and output should be binar. |
jacobi | string,string -> longint | Computes Jacobi symbol, where first number is up, second down. Input should be binar, second number odd. |
sprawdz | string -> boolean | Checks if given string is proper number i.e. it hasn't got any letters. |
longintuj | string,longint -> longint | Changes a number in given positional system into longint. |
millero | string,string,string -> boolean | Function computing a single Miller's test - used in mill. |
mill | string,longint -> boolean | Miller's test for first number, computed using given number of single tests. |
randprim | string -> string | Returns a binar prime number lower than given range. |
megamodu | mstring,mlongint -> mstring | modulo for mstrings. |
odwrot | string,string -> string | Computes t^(-1) in Zp. |
wyp | mstring -> NONE | Writes mstring properly. |
strassen | string,longint -> boolean | Computes given number of Strassen's tests to find out, if given number is prime. |
To see source code of bignumber unit click here.