Relational operator == doesn't work properly in some cases!

조회 수: 7 (최근 30일)
Masood
Masood 2020년 1월 15일
답변: Star Strider 2020년 1월 15일
When I run this code:
1.1-1==0.1
I recieve this:
ans =
logical
0
I think it's not rational. Could somebody explain why I'm getting that result?

채택된 답변

Star Strider
Star Strider 2020년 1월 15일
You are seeing the effects of floating-point approximation error.

추가 답변 (0개)

카테고리

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