why '==' is not working properly, or what do I do wrong?

I just want to know why this happens...
Untitled.png

1 件のコメント

Bob Thompson
Bob Thompson 2018 年 11 月 21 日
More than likely this is a limitation of the binary. If you expand the number of sigfigs on a(5) and b(100) you will likely find that some small decimal place is slightly different.

サインインしてコメントする。

回答 (1 件)

Jos (10584)
Jos (10584) 2018 年 11 月 21 日

2 投票

There is a small difference, as shown by subtraction:
b(100)-a(5)
To tolerate such a small difference between x and y, try this
abs(x-y) < .0001

カテゴリ

質問済み:

2018 年 11 月 21 日

回答済み:

2018 年 11 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by