Transform a floating point number into a rational : exact float2rational

### 5.8.1 Transform a floating point number into a rational : exact float2rational

float2rational or exact takes as argument a floating point number d and returns a rational number q close to d such that abs(d-q)<epsilon. epsilon is defined in the cas configuration (Cfg menu) or with the cas_setup command.
Input :

float2rational(0.3670520231)

Output when epsilon=1e-10:

127/346

Input :

evalf(363/28)

Output :

12.9642857143

Input :

float2rational(12.9642857143)

Output :

363/28

If two representations are mixed, for example :

1/2+0.7

the rational is converted to a float, output :

1.2

Input :

1/2+float2rational(0.7)

Output :

6/5