Asset - Extension IBig, your BigInteger library for GML

xDGameStudios

GameMaker Staff
GameMaker Dev.
Hi everyone,

here xD, from xDGameStudio. some weeks ago I realized the marketplace didn't offer a good library to handle algebraic and logical with integers that go beyond 64bit in size. So I decided to put together an extension library to do just that.

This library handles all the basic algebraic operations: sum, subtraction, multiplication and division.
And also is able to deal with logical operation, for comparing two BigIntegers

The functions use a simple naming convention,

Code:
// Creating a BigInteger
var big = ibig_create(int/string);
// Add
output = ibig_add(big, big/int/string);
// Subtract
output = ibig_subtract(big, big/int/string);
// Multiply
output = ibig_multiply(big, big/int/string);
// Divide
output = ibig_divide(big, big/int/string);

// Negate
output = ibig_negate(big);

// Comparison
ouput = ibig_compare(big, big/int/string) // returns -1 (less than), 0 (equals), 1 (greater than)

// Converts to string (decimal format)
output = ibig_to_string(big);
NOTE: all the functions return a result so the operations do not edit the original input values.
NOTE: string inputs can be positive or negative values but only integers (at the moment no checks are being made)

Below is the link to the extension (GMS2 only)
https://marketplace.yoyogames.com/assets/8949/xdstudios-ibig
 
Top