rat - Floating point rational approximation
[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*abs(x). The rational approximations are generated by truncating continued fraction expansions. tol = 1.e-6*norm(X,1) is the default. y = rat(x,tol) return the quotient N./D
[n,d]=rat(%pi) [n,d]=rat(%pi,1.d-12) n/d-%pi