how to get correct value on division in matlab
6 views (last 30 days)
Show older comments
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.
0 Comments
Answers (2)
dpb
on 13 Apr 2016
>> 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.
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!