Skip to content

sh1ngekyo/BigIntegerExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Big Integer Example

BigInt implementation ported from old C code

Operations

  • Addition
  • Subtraction
  • Multiplication
  • Division
  • Modulo

Usage:

Initialize:

var number = new BigInt(1234);

Or

BigInt number = 1234;

Same with strings:

BigInt number = "-123456789";

Add:

var result = new BigInteger("123456789") + 123456L;
result += "999999";

Sub:

var result = new BigInteger("123456789") - 123456L;
result -= "999999";

Mul:

var result = new BigInteger("123456789") * 123456L;
result *= "999999";

Div:

var result = new BigInteger("123456789") / 123456L;
result /= "2";

Mod:

var result = new BigInteger("123456789") % 123456L;
result %= "2";

CompareTo:

var result = new BigInteger("123456789").CompareTo("12345676");

Releases

No releases published

Packages

No packages published

Languages