matlab digit precision is not correct?

2 ビュー (過去 30 日間)
Ahmad Agbaria
Ahmad Agbaria 2020 年 4 月 7 日
コメント済み: Ahmad Agbaria 2020 年 4 月 8 日
Quoting from:
By default, MATLAB® uses 16 digits of precision.
But why when I write 900000000+2 (8 zeros after 9) it returns 900000002 but writing 900000000+2 (9 zeros after 9)returns 9.0000e+09 isn't this an 8 digit precision?

回答 (1 件)

James Tursa
James Tursa 2020 年 4 月 7 日
編集済み: James Tursa 2020 年 4 月 7 日
That is just a display artifact. The entire number is still there in memory. Do this to change the display format
format longg
and then repeat your test.
  1 件のコメント
Ahmad Agbaria
Ahmad Agbaria 2020 年 4 月 8 日
Thanks

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by