Floating point relational operator.

版本 1.2.0.0 (2.9 KB) 作者: Jan Orwat
Numerical comparison with specified precision.
124.0 次下载
更新时间 2016/6/1

查看许可证

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

引用格式

Jan Orwat (2025). Floating point relational operator. (https://www.mathworks.com/matlabcentral/fileexchange/57457-floating-point-relational-operator), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2016a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Numeric Types 的更多信息
标签 添加标签
致谢

参考作品: numcmp.m

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
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.