I am confused with how numbers are represented in Matlab.
Considering this sequence of computations, carried out using 64-bit arithmetic in Matlab:
format longg
i = 0:8;
a = sin(i*(pi/2))
When doing these calculations by hand, I would expect to see the results a = 0, 1, 0, –1, 0, etc. But that is not what Matlab shows. Why not? Is it because pi is not in machine number?
In addition,
format long
a = 2^(60);
b = 20000;
c = a + b;
d = c – a
When doing these calculations by hand, I would expect to see the result d = 20000. But that is not what Matlab returns. Why not?