DocumentationMathematicaBuilt-in FunctionsNumerical ComputationNumber 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[x, dx] yields the rational number with the smallest denominator that lies within dx of x.
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 Section 3.2.2.
See also: Chop, Round, ContinuedFraction, LatticeReduce.
Related package: NumberTheory`Rationalize`.
New in Version 1.