code typo, upper one count conformities, below non-conformities
x=1;
stp=1;
err_strict = (ref(x) > ref(x+stp)) ~= (f(x) > f(x+stp)) | ...
(ref(x) < ref(x+stp)) ~= (f(x) < f(x+stp)) | ...
(ref(x) == ref(x+stp)) ~= (f(x) == f(x+stp));
err_relaxed = (ref(x) >= ref(x+stp)) ~= (f(x) >= f(x+stp)) | ...
(ref(x) <= ref(x+stp)) ~= (f(x) <= f(x+stp));
disp(err_strict)
disp(err_relaxed)
function [y] = ref(x)
y = x+1;
end
function [y] = f(x)
y = single(x)+1;
end
Is this the fastest way to implement ? considering large number of tests (stepping size constraint).