This extension library allows for handling Big Integers and perform basic arithmetical and logical operations with them.
functions included are:
ibig_create(value); ibig_add(value, value); ibig_subtract(value, value); ibig_multiply(value, value); ibig_divide(value, value); ibig_compare(value, value); ibig_negate(value); ibig_to_string(value);
Operations are very fast, and code is optimized for perfomance:
var a = ibig_create("12345678902341234987654321"); var c = ibig_add(a, "12345678902341234987654321"); // 11 microseconds var a = ibig_create("12345678902341234987654321"); var c = ibig_multiply(a, "12345678902341234987654321"); // 25 microseconds
Other functions that include the name ibig but start and end with "__" (double underscore) are called internally and should not be used.
NOTE: ibig functions do not edit the current number they return a new number on each call so you have to store the return value.
var _ibig = ibig_create(1234); var _sum = ibig_add(_ibig, "13241234");
NOTE: for performance reasons this library for the time being doesn't perform arguments checks so please use only strings (positive or negative representing integer numbers) or numbers (integers, positive or negative) or other ibig as input.