3 -- Grant of Unlimited Rights
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7 -- unlimited rights in the software and documentation contained herein.
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
9 -- this public release, the Government intends to confer upon all
10 -- recipients unlimited rights equal to those held by the Government.
11 -- These rights include rights to use, duplicate, release or disclose the
12 -- released technical data and computer software in whole or in part, in
13 -- any manner and for any purpose whatsoever, and to have or permit others
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
26 -- FOUNDATION DESCRIPTION:
27 -- This file simulates a generic complex integer support package, to be
28 -- used for tests covering generic formal packages.
31 -- 06 Dec 94 SAIC ACVC 2.0
35 generic -- Complex integer abstraction.
36 type Int_Type
is range <>;
39 -- Simulate a generic complex integer support package. Complex integers
40 -- are treated as coordinates in the Cartesian plane.
43 type Complex_Type
is private;
45 Zero
: constant Complex_Type
; -- (0,0).
46 One
: constant Complex_Type
; -- (1,0).
49 function "-" (Right
: Complex_Type
) -- Invert a complex
50 return Complex_Type
; -- integer.
52 function "+" (Left
, Right
: Complex_Type
) -- Add two complex
53 return Complex_Type
; -- integers.
55 function "*" (Left
, Right
: Complex_Type
) -- Multiply two complex
56 return Complex_Type
; -- integers.
58 function Reciprocal
(Right
: Complex_Type
) -- Return the reciprocal
59 return Complex_Type
; -- of a complex integer.
61 function Complex
(Real
, Imag
: Int_Type
) -- Create a complex
62 return Complex_Type
; -- integer.
66 type Complex_Type
is record
71 Zero
: constant Complex_Type
:= (Real
=> 0, Imag
=> 0);
72 One
: constant Complex_Type
:= (Real
=> 1, Imag
=> 0);
77 --==================================================================--
80 package body FC70A00
is -- Complex integer abstraction.
82 function Complex
(Real
, Imag
: Int_Type
) return Complex_Type
is
84 return ( (Real
, Imag
) );
87 --==============================================--
89 function "-" (Right
: Complex_Type
) return Complex_Type
is
91 return ( (-Right
.Real
, -Right
.Imag
) );
94 --==============================================--
96 function "+" (Left
, Right
: Complex_Type
) return Complex_Type
is
98 return ( (Left
.Real
+ Right
.Real
, Left
.Imag
+ Right
.Imag
) );
101 --==============================================--
103 function "*" (Left
, Right
: Complex_Type
) return Complex_Type
is
105 return ( (Real
=> (Left
.Real
* Right
.Real
) - (Left
.Imag
* Right
.Imag
),
106 Imag
=> (Left
.Imag
* Right
.Real
) + (Left
.Real
* Right
.Imag
)) );
109 --==============================================--
111 function Reciprocal
(Right
: Complex_Type
) return Complex_Type
is
112 Denominator
: Int_Type
:= Right
.Real
**2 + Right
.Imag
**2;
113 begin -- NOTE: Results are truncated.
114 return ( (Right
.Real
/Denominator
, -Right
.Imag
/Denominator
) );