Floating point relational operator.

Version 1.2.0.0 (2,85 ko) par Jan Orwat
Numerical comparison with specified precision.
124 téléchargements
Mise à jour 1 juin 2016

Afficher la licence

This function provides comparison operation improvement for floating point numbers.
Singleton expansion, multidimensional arrays supported.
example:
>> A = [ 1, 1, 1, 100, 1, 4];
>> B = [ 1, 1.2, 1.01, 101, 4, 1];
>> A<B
ans = 0 1 1 1 1 0
>> numcmp(A,B,1,1,@lt)
ans = 0 1 0 0 1 0

Citation pour cette source

Jan Orwat (2026). Floating point relational operator. (https://fr.mathworks.com/matlabcentral/fileexchange/57457-floating-point-relational-operator), MATLAB Central File Exchange. Extrait(e) le .

Compatibilité avec les versions de MATLAB
Créé avec R2016a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Numeric Types dans Help Center et MATLAB Answers
Remerciements

Inspiré par : numcmp.m

Version Publié le Notes de version
1.2.0.0

.

1.1.0.0

inf/nan errors solved. Please note that with numcmp infinities are not equal. inf == inf returns 1, while numcmp(inf,inf) returns 0. This is actually closer to reality:)
function rewritten, relative tolerance introduced.
bugs left to solve: eliminate errors when infs/nans are used.

1.0.0.0

Note, this function uses only absolute precision.