The title says it all: I want to calculate an exponent in matlab with big numbers, but I get overflow and it just returns infinity.
>> 100^1000
ans =
To deal with large numbers there is also the class High Precision Float, with which the result can be achieved by writing
a = hpf(100);
b = hpf(1000);
c = a^b;
which gives c = 1.e2000
. A call to struct(c)
provides informations on how the number is internally stored.
struct(c)
ans =
NumberOfDigits: [64 4]
DecimalBase: 4
Base: 10000
Numeric: 0
Sign: 1
Exponent: 2001
Migits: [1000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]