This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Built-in Functions / Numerical Computation / Number Representation  /

  • Rationalize[ x ] takes Real numbers in x that are close to rationals, and converts them to exact Rational numbers.
  • Rationalize[ x , dx ] performs the conversion whenever the error made is smaller in magnitude than dx.
  • Example: Rationalize[3.78].
  • Rationalize[N[Pi]] does not give a rational number, since there is none "sufficiently close" to N[Pi].
  • A rational number is considered "sufficiently close" to a Real if , where is chosen to be .
  • Rationalize[ x , 0] converts any x to rational form.
  • See the Mathematica book: Section 3.1.3.
  • See also: Chop, Round, LatticeReduce.
  • Related package: NumberTheory`Rationalize`, NumberTheory`ContinuedFractions`.