1 package Rational_Arithmetic is
3 type Whole is new Integer;
5 -- Undefine unwanted operations
6 function "/" (Left, Right: Whole) return Whole is abstract;
10 type Rational is private;
14 function "/" (Left, Right: Whole) return Rational;
16 -- Rational operations
18 function "-" (Left, Right: Rational) return Rational;
22 function "+" (Left: Whole ; Right: Rational) return Rational;
23 function "-" (Left: Whole ; Right: Rational) return Rational;
24 function "-" (Left: Rational; Right: Whole ) return Rational;
25 function "/" (Left: Whole ; Right: Rational) return Rational;
26 function "*" (Left: Whole ; Right: Rational) return Rational;
27 function "*" (Left: Rational; Right: Whole ) return Rational;
31 function "=" (Left: Rational; Right: Whole) return Boolean;
34 type Rational is record
35 Numerator, Denominator: Whole;
37 end Rational_Arithmetic;