A rational is represented as a pair of integers, called numerator and denominator . Numerator and denominator are reduced , i.e., their greatest common divisor is 1. If the denominator is 1, the rational is in fact an integer and is represented as such. The numerator holds the sign of the rational, thus the denominator is always positive. Because the underlying integer arithmetic can compute with arbitrary size integers, the rational arithmetic is always exact, even for rationals whose numerators and denominators have thousands of digits.
Rationals is the field domain of all rationals.
IsRat returns true if obj , which can be an arbitrary object, is a rational and false otherwise. Integers are rationals with denominator 1, thus IsRat returns true for integers. IsRat will signal an error if obj is an unbound variable or a procedure call. Because the numerator holds the sign of the rational it may be any integer. Integers are rationals with denominator 1, thus Numerator is the identity function for integers.