This section describes functions which support long integers (longint), i.e. integer numbers with an arbitrary number of digits limited only by the memory available. Some LME functions have been overloaded: new definitions have been added and are used when at least one of their arguments is of type longint. These functions are listed in the table below.
LME | Operator | Purpose |
---|---|---|
abs | absolute value | |
char | conversion to string | |
disp | display | |
double | conversion to floating-point | |
gcd | greatest common divisor | |
lcm | least common multiple | |
minus | - | subtraction |
mldivide | \ | left division |
mpower | ^ | power |
mrdivide | / | right division |
mtimes | * | multiplication |
plus | + | addition |
rem | remainder | |
uminus | - | negation |
uplus | + | no operation |
Creation of a long integer.
li = longint(i) li = longint(str)
longint(i) creates a long integer from a native LME floating-point number. longint(str) creates a long integer from a string of decimal digits.
longint('1234567890') 1234567890 longint(2)^100 1267650600228229401496703205376
13th Mersenne prime:
longint(2)^521-1 6864797660130609714981900799081393217269 4353001433054093944634591855431833976560 5212255964066145455497729631139148085803 7121987999716643812574028291115057151
Number of decimal digits in the 27th Mersenne prime:
length(char(longint(2)^44497-1)) 13395