how to get correct value on division in matlab

조회 수: 6 (최근 30일)
Anil Verma
Anil Verma 2016년 4월 13일
답변: dpb 2016년 4월 13일
I am dividing 60 by 88.8888888888889 in matlab. It is giving result as 0.675000000000000. But when I am doing the same calculation on a calculator, the result is 0.674999999999999.
How to get 0.674999999999999 as result using matlab. Please help.

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 13일
Use vpa function

dpb
dpb 2016년 4월 13일
>> 60/88.8888888888889-4*eps(ans)
ans =
0.674999999999999
>>
Can't expect FP precision to be the same between Matlab and another computing platform; there can be differences even with the same computation of different computers owing to word sizes and implementation.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by