Rationalize
Rationalize[x] converts an approximate number x to a nearby rational with small denominator.
Rationalize[x,dx] yields the rational number with smallest denominator that lies within dx of x.
Please visit the official Wolfram Language Reference for more details and examples on core symbols.