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

6 Ansichten (letzte 30 Tage)
George Rusu
George Rusu am 21 Nov. 2018
Beantwortet: Jos (10584) am 21 Nov. 2018
I just want to know why this happens...
Untitled.png
  1 Kommentar
Bob Thompson
Bob Thompson am 21 Nov. 2018
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jos (10584)
Jos (10584) am 21 Nov. 2018
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

Kategorien

Mehr zu Elementary Math finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by