The size of an integer depends the int type of the C compiler. Usually an integer uses 32 bytes of memory and has a value between -2147483647 and 2147483647.
An integer constant is entered with the z suffix. For example, 2899z is an integer while 2899 is a double precision number.
If all the elements in a bracket expression are integers, the result is an integer matrix. For example, [2z, -3z, 56z].
The set of all integers is _Z.
A number with suffix M is an Mpf constant.
>> x = 1.3352M 1.33519999999999999999999999999999E0Operations involving Mpf usually produces Mpf results. » sqrt(x) 1.15550854605234313688808503023426E0
An Mpf matrix is created if all components in a bracket expression are Mpf's
>> X = [3.1M; 2.2M; -1.55M] 3.09999999999999999999999999999999E0 2.19999999999999999999999999999999E0 -1.54999999999999999999999999999999E0
The functions zeros, ones, and rand returns Mpf matrices if the last argument is _M. For example
>> x = rand(5, 1, \_M) 9.3021775040240436056832347452058E-1 8.5311813443668253119942506400455E-1 7.7238437656903267296393271625706E-1 5.8162992980263383743533686828037E-1 8.8838553079998591821584992499428E-1
The following commands solve a system of linear equations using Mpf
>> A = rand(10, 10, \_M); >> b = rand(10, \_M); >> x = A \ b; >> norm(A * x - b) 4.7817994155912976409669674814276E-38
The default precision of Mpf is 128 binary digits, or about 38 decimal digits. The precision can be changed by assigning a new value to global variable mpf_ndigits. The new value must be a multiple of 32.
>> global.mpf\_ndigits = 256; >> r = sqrt(2M); >> r\^2 - 2M -3.45446742203777785e-77
Note that Mpf computations are much much slower and more resource consuming than regular double precision computations.
A number with suffix L is a long integer. The magnitude of a long integer is limited only by the system's resources. For example
>> n = 123456789012345678901234567890L 123456789012345678901234567890 >> factorial(50L) 30414093201713378043612608166064768844377641568960512000000000000Be very careful when using long integers, one integer that is too long may use up all the system memory.
A byte is a small integer with value between 0 and 256. A byte is entered with B suffix, like 35B. A matrix of bytes is created with domain specified by the set _B. For example, x = zeros(15, _B);
oz 2009-12-22