Skip to content

Latest commit

 

History

History
57 lines (39 loc) · 1.58 KB

File metadata and controls

57 lines (39 loc) · 1.58 KB

BigInteger

Big Integer library for c++. Implements basic operations which are described below.

Prerequisites:

  • source code must use namespace std and string header.
  • Every funtion returns the value in the form of string.

Operations available:

Addition

Adds two big integers.
string addition(string, string)

Subtraction

Substracts second paramter from first.
string subtraction(string, string)

Multiplication

Multiplies two big integers
string multiply(string, string)

Divide

Divides two big integers. First parameter is dividend and the second is divisor.
string divide(string, string)

Factorial

Calculates factorial of given integer. Parameter passes must not overflow int.
string factorial(int)

GCD

Calculates GCD of two big integers.
string gcd(string, string)

Fast Exponentiation

Does expoenentiation on given big integer. First parameter is base and the second is expoent value. Exponent value must not overflow long long.
string fast_expo(string, long long)

Conversion from Binary to Decimal

Converts given binary string into its decimal value.
string to_decimal(string)

Conversion from Decimal to Binary

Converts given decimal integer string into binary.
string to_binary(string)

Compare Two Big Integers

Returns true if first parameter is greater than second otherwise false.
bool comp(string, string)

Compare Two Big Integers in Binary

Returns true if first parameter is greater than second otherwise false.
bool bin_comp(string, string)