<ratio>

An exact fractional number.

A ratio has two slots: numerator and denominator.  It is normalized so that it has a positive denominator, and the greatest common divisor of the numerator and the denominator is one.  Ratios are never automatically converted to integers.  For example, ratio(4, 2) would return 2/1.

A numeric operation involving two ratios produces a normalized ratio result.  A numeric operation involving a ratio and an integer produced a normalized ratio result.  A numeric operation involving a ratio and a float produces a float result.

Exported from

Modifiers

concrete free sealed functional

Make keywords

numerator:An instance of <extended-integer>.
denominator:An instance of <extended-integer>.  Guaranteed positive.

Superclasses

Functions on <ratio>

Functions returning <ratio>

  • ratio
  • Arithmetic functions
Ultimately, there will be several, more logically separate libraries that extend Dylan or provide an application framework for users.
An integer of any size.
The class of rational numbers.
Returns the numerator of a ratio.
Returns the denominator of a ratio.
Makes a ratio from two integers.