why there is a small error in these simple calculations?
1 回表示 (過去 30 日間)
古いコメントを表示
3e-4-3*10^-4
sum=0;
for i=1:1000
sum=sum+0.001;
end
sum_output=sum
this gives an answer of -5.421010862427522e-20 and 1.000000000000001
it should be obviously 0 and 1. what happened during the running of program??
1 件のコメント
回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!