About the calculation precise
이전 댓글 표시
The precise of calculation has a problem when I add 60.425 with 0.425. The exact value should be 60.85, however I just got 60.8499999..., which affects my following calculation. How I can avoid such problem?
채택된 답변
추가 답변 (1개)
James Tursa
2013년 8월 22일
For your particular example, none of the values can be represented in IEEE double exactly:
>> num2strexact(60.425)
ans =
6.04249999999999971578290569595992565155029296875e1
>> num2strexact(0.425)
ans =
0.424999999999999988897769753748434595763683319091796875
>> num2strexact(60.425+0.425)
ans =
6.0849999999999994315658113919198513031005859375e1
You can find num2strexact here:
카테고리
도움말 센터 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!