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

6 ビュー (過去 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 Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by