Skip to content

Rationalize

Finds a simple rational number near x.

Wolfram LanguageRationalize
Rationalize(x)the simplest rational within about one machine epsilon of x.
Rationalize(x, tolerance)the simplest rational within the given tolerance of x.

Domain: Arithmetic

Details
  • Finds a simple rational number near x.
  • With one argument, it finds the simplest fraction within about one machine epsilon of x's current value; a second argument sets an explicit tolerance instead.
  • An already-exact rational (or integer) is returned unchanged.
  • Builds the approximation via continued fractions, the same technique behind classic approximations like .

Examples

See also: Round