Your answer is in F
and D
. Because your a
is much larger than the example a
(i.e. e5
vs e2
) which they state is just barely within Matlab's range, yours must be well out of the range and thus becomes inf
. But it doesn't matter because D
and F
hold your answer, you aren't supposed to be checkin g it against exp(a)
, the example only calculates exp(a)
to demonstrate the proof of concept. But the whole point of this code is to give you a way to find exp
of giant numbers.
In your case you get
D =
307797
and
F =
3.374110424643062 % Use format long
thus your answer is 3.374110424643062e+307797