summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/rational_arithmetic.ads
blob: f4398c5143cfca01154b66f23e95c4404dfd6f41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package Rational_Arithmetic is
  -- Whole numbers
  type Whole is new Integer;
--
  -- Undefine unwanted operations
  function "/" (Left, Right: Whole) return Whole is abstract;
--
  -- Rational numbers
--
  type Rational is private;
--
  -- Constructors
--
  function "/" (Left, Right: Whole) return Rational;
--
  -- Rational operations
--
  function "-" (Left, Right: Rational) return Rational;
--
  -- Mixed operations
--
  function "+" (Left: Whole   ; Right: Rational) return Rational;
  function "-" (Left: Whole   ; Right: Rational) return Rational;
  function "-" (Left: Rational; Right: Whole   ) return Rational;
  function "/" (Left: Whole   ; Right: Rational) return Rational;
  function "*" (Left: Whole   ; Right: Rational) return Rational;
  function "*" (Left: Rational; Right: Whole   ) return Rational;
--
  -- Relational
--
  function "=" (Left: Rational; Right: Whole) return Boolean;
--
private
  type Rational is record
    Numerator, Denominator: Whole;
  end record;
end Rational_Arithmetic;