Cannot subtract number of order smaller then e-4 from variable
9 ビュー (過去 30 日間)
古いコメントを表示
a=0.1; a=a-1e-5 gives result a=0.1000
0 件のコメント
採用された回答
Torsten
2024 年 11 月 26 日
編集済み: Torsten
2024 年 11 月 26 日
It's just a question of how the numbers are displayed.
Internally, the precision of computing is much higher.
format long % Use display format long
a = 0.1;
a = a - 1e-5
format short
a
3 件のコメント
Walter Roberson
2024 年 11 月 26 日
編集済み: Walter Roberson
2024 年 11 月 26 日
format long % Use display format long
a = 0.1;
fprintf('%.999g\n', a)
a = a - 1e-5
fprintf('%.999g\n', a)
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!