0.41==0.4+1*0.01 is False but 0.31==0.3+1*0.01 is True??

Hi all, My friend encountered this interesting question in matlab. In command windows, compute 0.41==0.4+1*0.01, ans=0 compute 0.31==0.3+1*0.01, ans=1 compute 0.51==0.5+1*0.01, ans=1 ... Does anyone know the reason? Thank you very much

Answers (2)

This effect is an evergreen in the FAQ. It is strongly recommended to read the FAQ, because it allows to learn from the problems of others.

Categories

Tags

Asked:

on 9 Dec 2011

Community Treasure Hunt

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

Start Hunting!