Previous Up Next

5.64.7  Rational approximation: float2rational exact

float2rational (or exact) takes as argument an expression.
float2rational returns a rational approximation of all the floating point numbers r contained in this expression, such that |rfloat2rational(r)|<є, where є is defined by epsilon in the cas configuration (Cfg menu, or cas_setup command).
Input:

float2rational(1.5)

Output:

3/2

Input:

float2rational(1.414)

Output:

707/500

Input:

float2rational(0.156381102937*2)

Output:

5144/16447

Input:

float2rational(1.41421356237)

Output:

114243/80782

Input:

float2rational(1.41421356237^2)

Output:

2

Previous Up Next