1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Asset - Extension IBig, your BigInteger library for GML

Discussion in 'Marketplace' started by xDGameStudios, Feb 4, 2020.

  1. xDGameStudios

    xDGameStudios Member

    Joined:
    Sep 15, 2016
    Posts:
    609
    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
     
    Tsa05 and Mert like this.

Share This Page