modifying/​rounding/a​proximatin​g a number

1 回表示 (過去 30 日間)
Opariuc Andrei
Opariuc Andrei 2020 年 10 月 30 日
コメント済み: Star Strider 2020 年 10 月 31 日
i need a way to modify a number a=2.65987 into 2.6598 i tried round /fprintf , but both display as 2.6599 ,i need it badly ,i could just pop it out of nowhere by substracting 0.00007 but that's not helping .

採用された回答

Star Strider
Star Strider 2020 年 10 月 30 日
One option:
c = floor(a*1E4)/1E4
producing:
c =
2.6598
.
  6 件のコメント
Opariuc Andrei
Opariuc Andrei 2020 年 10 月 31 日
i checked , she doesn't know , i gave her something to ponder about :) / homework
Star Strider
Star Strider 2020 年 10 月 31 日
Interesting!
Check the link I posted — the link information is correct.
While I would normally suggest that the difference between the two in the precision of the diaplayed numbers could account for the difference, that is not the situation here, where the display precision is not changing.

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by