In mathematics, a rational number is any number that can be expressed as the quotient or fraction p/q of two integers, with the denominator q not equal to zero.

Some programming languages provide a built-in (primitive) rational data type to represent rational numbers and to do arithmetic on them (e.g. the ratio type of Common Lisp and analogous types provided by most languages for algebraic computation, such as Mathematica and Maple).

Many languages that do not have a built-in rational type still provide it as a library-defined type.