# Revision history [back]

There are at least three ways to recover a rational from one of its numerical approximations:

sage: a = .1/8
sage: a.simplest_rational()
1/80
sage: a.nearby_rational(0.0001)
1/80
sage: a.exact_rational()
3602879701896397/288230376151711744


You can have a look to their respective documentations to see the differences.

There are at least three ways to recover a rational from one of its numerical approximations:

sage: a = .1/8
sage: a.simplest_rational()
1/80
sage: a.nearby_rational(0.0001)
1/80
sage: a.exact_rational()
3602879701896397/288230376151711744


You can have a look to their respective documentations to see the differences.differences. And you should understand that a is not equal to 1/80 but to 3602879701896397/288230376151711744 !

There are at least three ways to recover a rational from one of its numerical approximations:

sage: a = .1/8
sage: a.simplest_rational()
1/80
sage: a.nearby_rational(0.0001)
1/80
sage: a.exact_rational()
3602879701896397/288230376151711744


You can have a look to their respective documentations to see the differences. And you should understand that a the floating point number a is not equal to 1/80 but to 3602879701896397/288230376151711744 !