Thanks for the information. I thought it would consider the floating point error the same way on both sides of the equation so I thought it was a bug as for some cases worked and some did not.
If I am looking for values with decimals on tables, how do I bypass this error? Is there a smart way or I need to check if the value is within value+- 10*eps for example?
The usual approach is to include a tolerance, something like this (using the requested criterion of 10*eps) —
TF1 = (28.15e-3 - 28.15/1000) == 0
TF1 = logical
0
TF2 = (28.15e-3 - 28.15/1000) <= 10*eps
TF2 = logical
1
So instead of testing for equality, do essentially the same thing with a subtraction, test it against the criterion, and return a logical value result.
I think the abs() is needed because one quantized expression could be above or below the other quantized expression, and I don't think you'd know which it will be in general.
Impossible de terminer l’action en raison de modifications de la page. Rechargez la page pour voir sa mise à jour.
Translated by
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.