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

7 vues (au cours des 30 derniers jours)
Masood
Masood le 15 Jan 2020
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?

Réponse acceptée

Star Strider
Star Strider le 15 Jan 2020
You are seeing the effects of floating-point approximation error.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by