Fraction

Fraction represents a rational number.

Fractions can be constructed by calling the Fraction(num, den) function.

If Fractions option is turned on in Language features, they are automatically created using the / operator between two integers.

Fractions support all arithmetic operations and comparison operators, for example, Fraction(1, 2) + Fraction(3, 4).

Syntax

Fraction

Properties

Prototype Properties

Examples

Fraction(1, 2)
$\frac{1}{2}$
Fraction(1, 2) + Fraction(3, 4)
$\frac{5}{4}$