Man Scilab

rat
Scilab Function

rat - Floating point rational approximation

Calling Sequence

[N,D]=rat(x [,tol])
y=rat(x [,tol])

Parameters

Description

[N,D] = rat(x,tol) returns two integer matrices so that N./D is close to x 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

Examples


[n,d]=rat(%pi)
[n,d]=rat(%pi,1.d-12)
n/d-%pi
 
  

See Also

int ,   round ,  

Back