Info

此问题已关闭。 请重新打开它进行编辑或回答。

Strange rounding errors?

1 次查看(过去 30 天)
Jan Wingens
Jan Wingens 2015-11-18
关闭: MATLAB Answer Bot 2021-8-20
I have a matrix A(7,7) with different real values.
If I do:
Test1=sum(sum(40*A));
Test2=40*sum(sum(A));
I get slightly different values for Test1 and Test2 (Test1-Test2=1e-8 or so)
In cases of simple matrix elements like numbers 1,2,3,etc. this doesn't happen. With my entries though, which are different in size...
Now I suppose this behaviour is due to rounding errors...What would be best? If I use Test2 for calculations?
Or is there something I misunderstood?

回答(0 个)

此问题已关闭。

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by