rat: likely documentation error
Bug Description
The documentation for the "rat" function says: [N,D] = rat(X,tol) returns two integer matrices so that N./D is close toX in the sense that abs(N./D - X) <= tol*norm(X,1)*abs(X). y=rat(x,tol) return the quotient N./D
It is supposed that the correct sentence should be: ... in the sense that abs(N./D - X) <= tol*norm(X,1).
Steps to reproduce
Here is a simple example:
x = sqrt(2)^13;
scf();
for eps = 10.^(-10 : 0.2 : -1)
y = rat(x, eps);
err1 = abs(x - y);
err2 = eps * norm(x, 1) * abs(x);
err3 = eps * norm(x, 1);
plot(eps, err1 / err2, "ro");
plot(eps, err1 / err3, "bo");
end
a = gca();
a.log_flags = "lnn";
The maximum value value for the blue curve is close to 1, whereas for the red curve, the maximum value seems to be way too small.
Error log
None