BigInt
BigInt is a long arithmetic library used in the Arithm Interpeter.
Type
An instanse of BigInt consists of Sign of <Sign> and Digits of <MyList<int>>.
Sign type has only two values - Positive and Negative.
MyList<int> consists of integers from 0 to 9
Functions
equal (x:BigInt) (y:BigInt)- returns result of "x = y" expressiongetSign (x:BigInt)- returns 1 for positive and -1 for negative numbeкreverseSign (x:BigInt)- changes a sign of a numberequalize (x:MyList<int>, y:MyList<int>)- adds zeroes to a begining of one list until their lengths are equaldelZeroHead (l:MyList<int>)- deletes all zeroes from the begining of a listaddZeroes (c:int) (l:MyList<int>)- addsczeroes to a beginingnotLesser (x:MyList<t>) (y:MyList<t>)- returns true if x is not lesser than y lexicographic ordermanageRemainders (_arg1:MyList<int>)- moves remainders to the next rank(for the digits in decimal system)sumOrSub (x:BigInt) (y:BigInt) (operator:int -> int -> int)- applies a given operator(usually "+" or "-") to a numberssum (x:BigInt) (y:BigInt)- returns sum of two numberssub (x:BigInt) (y:BigInt)- returns a result of subtraction of two numbersmul (x:BigInt) (y:BigInt)- returns a result of multiplication of two numbersdivOrRem (x:BigInt) (y:BigInt)- returns a pair of remainder and whole part of division inBigInttypediv (x:BigInt) (y:BigInt)- returns a whole part of divisionrem (x:BigInt) (y:BigInt)- returns a remainder from divisionpower (x:BigInt) (y:BigInt)- returns a result of exponentiationtoBinary (x:BigInt)- converts a number to it's binary representationstringToBigInt (n:string)- converts astringtoBigIntbigIntToString (n:BigInt)- converts aBigInttostringabs (x:BigInt)- return an absolute value of a number