The bignumber unit

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:

NameVarsComment
mstring TYPEA record that contains zn - a longint 1 or -1 that indicates a sign, and war - string, the value.
initialize NONEShould be executed before using bignumber unit.
wch, wlo longint -> char, char -> longintChanges longint to char and vice versa.
przez2 string,longint -> stringDivides given number in given positional system by 2.
zmienw2 string,longint -> stringChanges given number in given positional system into binar. Base of system should be even.
mn string,string -> booleanGives TRUE if first number is less or equal to the second.
wyczysc string -> stringClears zeros before the number.
bezkon string->stringClears zeros after the number.
bez string -> stringClears the last digit of the number.
od string,string -> stringComputes the difference between two binar numbers. First should be greater or equal than second.
nwduj string,string->stringComputes greatest common divisor of two binar numbers. Result is also binar.
modulo string,string -> stringComputes first string modulo second. Input and output should be binar.
dod string,string,longint -> stringComputes sum of two numbers in a given positional system.
zmien string,longint -> longintChanges binar number into other positional system.
rand string -> stringProduces random binar number in range from 1 to given in input.
mul string,string -> stringMultiplicates two binar numbers.
poteg string,string,string -> stringComputes (a^b) mod c wher a,b,c are input. Input and output should be binar.
jacobi string,string -> longintComputes Jacobi symbol, where first number is up, second down. Input should be binar, second number odd.
sprawdz string -> booleanChecks if given string is proper number i.e. it hasn't got any letters.
longintuj string,longint -> longintChanges a number in given positional system into longint.
millero string,string,string -> booleanFunction computing a single Miller's test - used in mill.
mill string,longint -> booleanMiller's test for first number, computed using given number of single tests.
randprim string -> stringReturns a binar prime number lower than given range.
megamodu mstring,mlongint -> mstringmodulo for mstrings.
odwrot string,string -> stringComputes t^(-1) in Zp.
wyp mstring -> NONEWrites mstring properly.
strassen string,longint -> booleanComputes given number of Strassen's tests to find out, if given number is prime.

To see source code of bignumber unit click here.

MAIN