필터 지우기
필터 지우기

Mis match in comparing the values

조회 수: 2 (최근 30일)
Raghavendra
Raghavendra 2012년 9월 11일
Hello all,
a=1.3;
b=0.1+0.2+0.2+0.3+0.3+0.1+0.1;
If I perform a==b, then I am getting the result 0(means both are not equal).
But actually they are equal(Both has a value of 1.3)
What's going wrong here? Plz let me know....
Best Regards,
Raghavendra
  댓글 수: 1
Jan
Jan 2012년 9월 11일
Dear Raghavendra, welcome to the world of floating point numbers on computers. Equivalent questions have been discussed such frequently, that this topic have been included in the FAQ. Follow Oleg's link and study the other problems also, because they occur frequently, as the name says already.
To all readers: If you have not done this already, read the FAQ also.

댓글을 달려면 로그인하십시오.

채택된 답변

Oleg Komarov
Oleg Komarov 2012년 9월 11일
  댓글 수: 1
Raghavendra
Raghavendra 2012년 9월 14일
Thank you for your answer:)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by