1 |
149 |
jeremybenn |
-- C45532F.ADA
|
2 |
|
|
|
3 |
|
|
-- Grant of Unlimited Rights
|
4 |
|
|
--
|
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
|
14 |
|
|
-- to do so.
|
15 |
|
|
--
|
16 |
|
|
-- DISCLAIMER
|
17 |
|
|
--
|
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.
|
24 |
|
|
--*
|
25 |
|
|
-- OBJECTIVE:
|
26 |
|
|
-- CHECK THAT THE OPERATOR "/" PRODUCES CORRECT RESULTS
|
27 |
|
|
-- FOR FIXED POINT TYPES USING 3 SUBTESTS.
|
28 |
|
|
-- THIS TEST REQUIRES MIN_WORD_LENGTH = 16.
|
29 |
|
|
-- THIS TEST USES VALUES OF DELTA WHICH ARE LESS THAN 0.5.
|
30 |
|
|
--
|
31 |
|
|
-- TEST CASES ARE:
|
32 |
|
|
-- A) THE OPERATOR /, A, B, AND A / B ALL MODEL NUMBERS.
|
33 |
|
|
-- B) THE OPERATOR /, A, B MODEL NUMBERS A / B NOT.
|
34 |
|
|
-- C) THE OPERATOR /, USING NO MODEL NUMBERS.
|
35 |
|
|
--
|
36 |
|
|
-- REPEAT FOR MINIMUM REQUIRED WORD LENGTHS OF 12, 16, 32 AND 48,
|
37 |
|
|
-- WITH RANGE <, =, AND > THAN 1.0 AND
|
38 |
|
|
-- WITH DELTA <, =, AND > THAN 1.0.
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
-- HISTORY:
|
42 |
|
|
-- NTW 09/08/86 CREATED ORIGINAL TEST.
|
43 |
|
|
-- RJW 11/05/86 REVISED COMMENTS.
|
44 |
|
|
-- DHH 10/19/87 SHORTENED LINES CONTAINING MORE THAN 72 CHARACTERS.
|
45 |
|
|
-- RDH 04/27/90 REVISED APPLICABILITY CRITERIA.
|
46 |
|
|
-- BCB 10/03/90 REMOVED APPLICABILITY CRITERIA AND N/A => ERROR
|
47 |
|
|
-- LINE. CHANGED EXTENSION FROM '.DEP' TO '.ADA'.
|
48 |
|
|
|
49 |
|
|
WITH REPORT;
|
50 |
|
|
PROCEDURE C45532F IS
|
51 |
|
|
|
52 |
|
|
USE REPORT;
|
53 |
|
|
|
54 |
|
|
MIN_WORD_LENGTH : CONSTANT := 16; -- MUST BE EVEN & >= 6
|
55 |
|
|
FULL_SCALE : CONSTANT := 2 ** (MIN_WORD_LENGTH - 1);
|
56 |
|
|
FORTH : CONSTANT := FULL_SCALE / 4;
|
57 |
|
|
A_THIRD : CONSTANT := FULL_SCALE / 3;
|
58 |
|
|
DEL1 : CONSTANT := 0.5 / FULL_SCALE;
|
59 |
|
|
TYPE FX_0P5 IS DELTA DEL1 * 1 RANGE -0.5 ..
|
60 |
|
|
0.5 - DEL1 * 1;
|
61 |
|
|
TYPE FX_1 IS DELTA DEL1 * 2 RANGE -1.0 ..
|
62 |
|
|
1.0 - DEL1 * 2;
|
63 |
|
|
TYPE FX_2 IS DELTA DEL1 * 4 RANGE -2.0 ..
|
64 |
|
|
2.0 - DEL1 * 4;
|
65 |
|
|
|
66 |
|
|
BEGIN TEST ("C45532F", "FIXED POINT OPERATOR ""/""" );
|
67 |
|
|
|
68 |
|
|
--------------------------------------------------
|
69 |
|
|
|
70 |
|
|
-- CASE A) THE OPERATOR /, A, B, AND A / B ALL MODEL NUMBERS.
|
71 |
|
|
|
72 |
|
|
A: DECLARE
|
73 |
|
|
A : FX_0P5 := 0.0;
|
74 |
|
|
B : FX_1 := 0.0;
|
75 |
|
|
RESULT_VALUE : FX_2 := 0.0;
|
76 |
|
|
LOWEST_ACCEPTABLE_VALUE : FX_2 := FX_2 (0.5);
|
77 |
|
|
HIGHEST_ACCEPTABLE_VALUE : FX_2 := FX_2 (0.5);
|
78 |
|
|
BEGIN
|
79 |
|
|
IF EQUAL (3, 3) THEN
|
80 |
|
|
A := FX_0P5 (0.125); -- A MODEL NUMBER
|
81 |
|
|
B := FX_1 (0.25); -- A MODEL NUMBER
|
82 |
|
|
END IF;
|
83 |
|
|
|
84 |
|
|
RESULT_VALUE := FX_2 (A / B);
|
85 |
|
|
|
86 |
|
|
IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
|
87 |
|
|
OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
|
88 |
|
|
FAILED ("RESULT OF ""/"" OUTSIDE RESULT MODEL INTERVAL "
|
89 |
|
|
& "WHEN A, B, AND A / B ARE ALL MODEL NUMBERS");
|
90 |
|
|
END IF;
|
91 |
|
|
END A;
|
92 |
|
|
|
93 |
|
|
--------------------------------------------------
|
94 |
|
|
|
95 |
|
|
-- CASE B) THE OPERATOR /, A, B MODEL NUMBERS A / B NOT.
|
96 |
|
|
|
97 |
|
|
B: DECLARE
|
98 |
|
|
A : FX_0P5 := 0.0;
|
99 |
|
|
B : FX_0P5 := 0.0;
|
100 |
|
|
RESULT_VALUE : FX_1 := 0.0;
|
101 |
|
|
LOWEST_ACCEPTABLE_VALUE : FX_1
|
102 |
|
|
:= FX_1 (2 * DEL1 * A_THIRD);
|
103 |
|
|
HIGHEST_ACCEPTABLE_VALUE : FX_1
|
104 |
|
|
:= FX_1 (2 * DEL1 * (A_THIRD + 1) );
|
105 |
|
|
BEGIN
|
106 |
|
|
IF EQUAL (3, 3) THEN
|
107 |
|
|
A := FX_0P5 (DEL1 * 1); -- A MODEL NUMBER
|
108 |
|
|
B := FX_0P5 (DEL1 * 3); -- A MODEL NUMBER
|
109 |
|
|
END IF;
|
110 |
|
|
|
111 |
|
|
RESULT_VALUE := FX_1 (A / B);
|
112 |
|
|
|
113 |
|
|
IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
|
114 |
|
|
OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
|
115 |
|
|
FAILED ("RESULT OF ""/"" OUTSIDE RESULT MODEL INTERVAL "
|
116 |
|
|
& "WHEN A, B MODEL NUMBERS A / B NOT");
|
117 |
|
|
END IF;
|
118 |
|
|
END B;
|
119 |
|
|
|
120 |
|
|
--------------------------------------------------
|
121 |
|
|
|
122 |
|
|
-- CASE C) THE OPERATOR /, USING NO MODEL NUMBERS
|
123 |
|
|
|
124 |
|
|
C: DECLARE
|
125 |
|
|
A : FX_1 := 0.0;
|
126 |
|
|
B : FX_1 := 0.0;
|
127 |
|
|
RESULT_VALUE : FX_0P5 := 0.0;
|
128 |
|
|
LOW_COUNT : CONSTANT := 2 * A_THIRD;
|
129 |
|
|
-- := (2 * FULL_SCALE * (2 * FORTH + 0))
|
130 |
|
|
-- / (6 * FORTH + 2);
|
131 |
|
|
HIGH_COUNT : CONSTANT := 2 * A_THIRD + 4;
|
132 |
|
|
-- := (2 * FULL_SCALE * (2 * FORTH + 2))
|
133 |
|
|
-- / (6 * FORTH + 0);
|
134 |
|
|
LOWEST_ACCEPTABLE_VALUE : FX_0P5
|
135 |
|
|
:= FX_0P5 (DEL1 * LOW_COUNT );
|
136 |
|
|
HIGHEST_ACCEPTABLE_VALUE : FX_0P5
|
137 |
|
|
:= FX_0P5 (DEL1 * HIGH_COUNT );
|
138 |
|
|
BEGIN
|
139 |
|
|
IF EQUAL (3, 3) THEN -- A AND B NOT MODEL NUMBERS
|
140 |
|
|
A := FX_1 (DEL1 * (2 * FORTH + 1));
|
141 |
|
|
B := FX_1 (DEL1 * (6 * FORTH + 1));
|
142 |
|
|
END IF;
|
143 |
|
|
|
144 |
|
|
RESULT_VALUE := FX_0P5 (A / B);
|
145 |
|
|
|
146 |
|
|
IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
|
147 |
|
|
OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
|
148 |
|
|
FAILED ("RESULT OF ""/"" OUTSIDE RESULT MODEL INTERVAL "
|
149 |
|
|
& "WHEN USING NO MODEL NUMBERS");
|
150 |
|
|
END IF;
|
151 |
|
|
END C;
|
152 |
|
|
|
153 |
|
|
--------------------------------------------------
|
154 |
|
|
|
155 |
|
|
|
156 |
|
|
RESULT;
|
157 |
|
|
|
158 |
|
|
END C45532F;
|