This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

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.
  • Rationalize[x] yields x unchanged if there no rational number close enough to x to satisfy the condition p/q-x<c/q2, with c chosen to be 10-4.
New in 1