I would like to know a good way of checking if a number x is a rational (two integers n,m exist so that x=n/m) in python.
In Mathematica, this is done by the functio
Any number with a finite decimal expansion is a rational number. You could always solve for instance
5.195181354985216
by saying that it corresponds to
5195181354985216 / 1000000000000000
So since floats and doubles have finite precision they're all rationals.