Octave code to perform arbitrary-precision integer arithmetic. It may or may not work in Matlab.
The supported operations are:
>> s = a = intinf (126) % Creation of intinf-class object from integer or string
>> b = intinf ('-792716404922304611755050042308687')
>> c = a + b % Addition
>> d = a - b % Subtraction
>> e = c * d % Multiplication
>> f = (e - a^2) / b % Exponentiation, division
>> f == -b % Logical operators
>> [q, r] = intinf_divide (b^2, a) % Divsion and remainder
>> x = intinf_rand (100) % Random number (here, with 100 digits)
TODO:
* Better errors.
* Make a package loadable by octave's pkg function.
octave-intinf
Infinite-precision integer arithmetic for Octave, written in Octave
Brought to you by:
etienne
Downloads:
0 This Week
Linux