MATLAB: Diag problem while substracting

diagsubstract;wrong answer

my rho total is a square matrix, and when I do that:
diag(rho_total-1)
it gives me
1.0e-15 *
0.444089209850063
0.444089209850063
-0.111022302462516
-0.111022302462516
-0.222044604925031
0.666133814775094
why is that e-15 there?

Best Answer

It's just a display format thing. It means each number shown is actually multiplied by 1.0e-15
E.g.,
>> [1 2 3]
ans =
1 2 3
>> [1e-16 2e-16 3e-16]
ans =
1.0e-015 *
0.1000 0.2000 0.3000
So the diagonal numbers of rho_total you show in your post were actually pretty close to 1, since the difference between them and 1 is close to eps(1).