When we add, subtract or multiply any two integers, the result is always an integer. However, dividing a numerator by a denominator that is not an integral divisor of the denominator yields a ratio:
1210 11 / .
100 330 / .
14 10 / .
Ratios are printed and can be input literally in the form above. Ratios are always reduced to lowest terms by factoring out the greatest common divisor of the numerator and denominator. A ratio with a denominator of 1 becomes an integer. Division with a denominator of 0 throws an error.
Ratios behave just like any other number -- all numerical operations work as you would expect.
1/2 1/3 + .
100 6 / 3 * .
Ratios can be taken apart:
numerator ( a/b -- a )
denominator ( a/b -- b )
>fraction ( a/b -- a b )See alsoRatio syntax