3 -- Grant of Unlimited Rights
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687 and
6 -- F08630-91-C-0015, the U.S. Government obtained unlimited rights in the
7 -- software and documentation contained herein. Unlimited rights are
8 -- defined in DFAR 252.227-7013(a)(19). By making this public release,
9 -- the Government intends to confer upon all recipients unlimited rights
10 -- equal to those held by the Government. These rights include rights to
11 -- use, duplicate, release or disclose the released technical data and
12 -- computer software in whole or in part, in any manner and for any purpose
13 -- whatsoever, and to have or permit others to do so.
17 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
18 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
19 -- WARRANTY AS TO ANY MATTER WHATSOVER, INCLUDING THE CONDITIONS OF THE
20 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
21 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
22 -- PARTICULAR PURPOSE OF SAID MATERIAL.
26 -- Check that universal fixed multiplying operators can be used without
27 -- a conversion in contexts where the result type is determined.
29 -- Note: This is intended to check the changes made to these operators
30 -- in Ada 95; legacy tests should cover cases from Ada 83.
33 -- 18 MAR 99 RLB Initial version
37 with Report
; use Report
;
41 type F1
is delta 2.0**(-1) range 0.0 .. 8.0;
43 type F2
is delta 2.0**(-2) range 0.0 .. 4.0;
45 type F3
is delta 2.0**(-3) range 0.0 .. 2.0;
51 type Fixed_Record
is record
58 function Ident_Fix
(X
: F3
) return F3
is
68 Test
("C455001", "Check that universal fixed multiplying operators " &
69 "can be used without a conversion in contexts where " &
70 "the result type is determined.");
73 C
:= A
* B
; -- Assignment context.
75 if C
/= Ident_Fix
(1.0) then
76 Failed
("Incorrect results for multiplication (1) - result is " &
82 if C
/= Ident_Fix
(1.0) then
83 Failed
("Incorrect results for division (1) - result is " &
90 if C
/= Ident_Fix
(0.625) then
91 Failed
("Incorrect results for multiplication (2) - result is " &
97 if C
/= Ident_Fix
(0.625) then
98 Failed
("Incorrect results for division (2) - result is " &
102 C
:= Ident_Fix
(0.75);
105 if C
/= Ident_Fix
(0.375) then
106 Failed
("Incorrect results for multiplication (3) - result is " &
110 C
:= Ident_Fix
(0.75);
113 if C
/= Ident_Fix
(1.5) then
114 Failed
("Incorrect results for division (3) - result is " &
118 A
:= 0.5; B
:= 0.3; -- Function parameter context.
119 if Ident_Fix
(A
* B
) not in Ident_Fix
(0.125) .. Ident_Fix
(0.25) then
120 Failed
("Incorrect results for multiplication (4) - result is " &
121 F3
'Image(A
* B
)); -- Exact = 0.15
125 if Ident_Fix
(A
/ B
) not in Ident_Fix
(0.5) .. Ident_Fix
(0.75) then
126 Failed
("Incorrect results for division (4) - result is " &
128 -- Exact = 0.625..., but B is only restricted to the range
129 -- 0.75 .. 1.0, so the result can be anywhere in the range
133 C
:= 0.875; B
:= 1.5;
134 R
:= (D
=> C
* 4.0, E
=> B
/ 0.5); -- Aggregate context.
137 Failed
("Incorrect results for multiplication (5) - result is " &
142 Failed
("Incorrect results for division (5) - result is " &
147 C
:= A
* F1
'(B * 2.0); -- Qualified expression context.
149 if C /= Ident_Fix(1.5) then
150 Failed ("Incorrect results for multiplication (6) - result is " &
155 C := F1'(B
/ 0.5) / A
;
157 if C
/= Ident_Fix
(0.75) then
158 Failed
("Incorrect results for division (6) - result is " &