MATLAB Answers

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

조회 수: 2(최근 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
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개)

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by