1 |
294 |
jeremybenn |
-- C45532L.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 = 32.
|
29 |
|
|
-- THIS TEST USES VALUES OF DELTA WHICH ARE GREATER THAN OR
|
30 |
|
|
-- EQUAL TO 0.5.
|
31 |
|
|
--
|
32 |
|
|
-- TEST CASES ARE:
|
33 |
|
|
-- A) THE OPERATOR /, A, B, AND A / B ALL MODEL NUMBERS.
|
34 |
|
|
-- B) THE OPERATOR /, A, B MODEL NUMBERS A / B NOT.
|
35 |
|
|
-- C) THE OPERATOR /, USING NO MODEL NUMBERS.
|
36 |
|
|
--
|
37 |
|
|
-- REPEAT FOR MINIMUM REQUIRED WORD LENGTHS OF 12, 16, 32 AND 48,
|
38 |
|
|
-- WITH RANGE <, =, AND > THAN 1.0 AND
|
39 |
|
|
-- WITH DELTA <, =, AND > THAN 1.0.
|
40 |
|
|
|
41 |
|
|
-- HISTORY:
|
42 |
|
|
-- NTW 09/08/86 CREATED ORIGINAL TEST.
|
43 |
|
|
-- RJW 11/05/86 REVISED COMMENTS.
|
44 |
|
|
-- DHH 01/13/88 ADDED APPLICABILITY CRITERIA AND STANDARD HEADER.
|
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 |
|
|
|
50 |
|
|
WITH REPORT;
|
51 |
|
|
PROCEDURE C45532L IS
|
52 |
|
|
|
53 |
|
|
USE REPORT;
|
54 |
|
|
|
55 |
|
|
MIN_WORD_LENGTH : CONSTANT := 32;
|
56 |
|
|
FULL_SCALE : CONSTANT := 2 ** (MIN_WORD_LENGTH - 1);
|
57 |
|
|
A_THIRD : CONSTANT := FULL_SCALE / 3;
|
58 |
|
|
RNG1 : CONSTANT := FULL_SCALE * 0.5;
|
59 |
|
|
TYPE FX_0P5 IS DELTA 0.5 RANGE -RNG1 * 1 .. RNG1 * 1 - 0.5;
|
60 |
|
|
TYPE FX_1 IS DELTA 1.0 RANGE -RNG1 * 2 .. RNG1 * 2 - 1.0;
|
61 |
|
|
TYPE FX_RNG1 IS DELTA RNG1
|
62 |
|
|
RANGE -RNG1 * FULL_SCALE .. RNG1 * (FULL_SCALE - 1);
|
63 |
|
|
|
64 |
|
|
BEGIN TEST ("C45532L", "FIXED POINT OPERATOR ""/""" );
|
65 |
|
|
|
66 |
|
|
--------------------------------------------------
|
67 |
|
|
|
68 |
|
|
-- CASE A) THE OPERATOR /, A, B, AND A / B ALL MODEL NUMBERS.
|
69 |
|
|
|
70 |
|
|
A: DECLARE
|
71 |
|
|
A : FX_RNG1 := 0.0;
|
72 |
|
|
B : FX_0P5 := 0.0;
|
73 |
|
|
RESULT_VALUE : FX_0P5 := 0.0;
|
74 |
|
|
LOWEST_ACCEPTABLE_VALUE : FX_0P5 := FX_0P5 (RNG1 / 2);
|
75 |
|
|
HIGHEST_ACCEPTABLE_VALUE : FX_0P5 := FX_0P5 (RNG1 / 2);
|
76 |
|
|
BEGIN
|
77 |
|
|
IF EQUAL (3, 3) THEN
|
78 |
|
|
A := FX_RNG1 (RNG1 * RNG1 / 4); -- A MODEL NUMBER
|
79 |
|
|
B := FX_0P5 (RNG1 / 2); -- A MODEL NUMBER
|
80 |
|
|
END IF;
|
81 |
|
|
|
82 |
|
|
RESULT_VALUE := FX_0P5 (A / B);
|
83 |
|
|
|
84 |
|
|
IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
|
85 |
|
|
OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
|
86 |
|
|
FAILED ("RESULT OF ""/"" OUTSIDE RESULT MODEL INTERVAL "
|
87 |
|
|
& "WHEN A, B, AND A / B ARE ALL MODEL NUMBERS");
|
88 |
|
|
END IF;
|
89 |
|
|
END A;
|
90 |
|
|
|
91 |
|
|
--------------------------------------------------
|
92 |
|
|
|
93 |
|
|
-- CASE B) THE OPERATOR /, A, B MODEL NUMBERS A / B NOT.
|
94 |
|
|
|
95 |
|
|
B: DECLARE
|
96 |
|
|
A : FX_RNG1 := 0.0;
|
97 |
|
|
B : FX_1 := 0.0;
|
98 |
|
|
RESULT_VALUE : FX_0P5 := 0.0;
|
99 |
|
|
LOWEST_ACCEPTABLE_VALUE : FX_0P5
|
100 |
|
|
:= FX_0P5 (0.5 * A_THIRD);
|
101 |
|
|
HIGHEST_ACCEPTABLE_VALUE : FX_0P5
|
102 |
|
|
:= FX_0P5 (0.5 * (A_THIRD + 1) );
|
103 |
|
|
BEGIN
|
104 |
|
|
IF EQUAL (3, 3) THEN
|
105 |
|
|
A := FX_RNG1 (RNG1); -- A MODEL NUMBER
|
106 |
|
|
B := FX_1 (3.0); -- A MODEL NUMBER
|
107 |
|
|
END IF;
|
108 |
|
|
|
109 |
|
|
RESULT_VALUE := FX_0P5 (A / B);
|
110 |
|
|
|
111 |
|
|
IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
|
112 |
|
|
OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
|
113 |
|
|
FAILED ("RESULT OF ""/"" OUTSIDE RESULT MODEL INTERVAL "
|
114 |
|
|
& "WHEN A, B MODEL NUMBERS A / B NOT");
|
115 |
|
|
END IF;
|
116 |
|
|
END B;
|
117 |
|
|
|
118 |
|
|
--------------------------------------------------
|
119 |
|
|
|
120 |
|
|
-- CASE C) THE OPERATOR /, USING NO MODEL NUMBERS
|
121 |
|
|
|
122 |
|
|
C: DECLARE
|
123 |
|
|
A : FX_RNG1 := 0.0;
|
124 |
|
|
B : FX_1 := 0.0;
|
125 |
|
|
RESULT_VALUE : FX_1 := 0.0;
|
126 |
|
|
LOWEST_ACCEPTABLE_VALUE : FX_1
|
127 |
|
|
:= FX_1 ( RNG1 - 3.0);
|
128 |
|
|
HIGHEST_ACCEPTABLE_VALUE : FX_1
|
129 |
|
|
:= FX_1 ( RNG1 + 4.0);
|
130 |
|
|
BEGIN
|
131 |
|
|
IF EQUAL (3, 3) THEN
|
132 |
|
|
A := FX_RNG1 (RNG1 * RNG1 / 3); -- NOT A MODEL NUMBER
|
133 |
|
|
B := FX_1 (RNG1 / 3); -- NOT A MODEL NUMBER
|
134 |
|
|
END IF;
|
135 |
|
|
|
136 |
|
|
RESULT_VALUE := FX_1 (A / B);
|
137 |
|
|
|
138 |
|
|
IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
|
139 |
|
|
OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
|
140 |
|
|
FAILED ("RESULT OF ""/"" OUTSIDE RESULT MODEL INTERVAL "
|
141 |
|
|
& "WHEN USING NO MODEL NUMBERS");
|
142 |
|
|
END IF;
|
143 |
|
|
END C;
|
144 |
|
|
|
145 |
|
|
--------------------------------------------------
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
RESULT;
|
149 |
|
|
|
150 |
|
|
END C45532L;
|