1 |
294 |
jeremybenn |
-- C45532P.DEP
|
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 = 48.
|
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 |
|
|
-- APPLICABILITY CRITERIA:
|
42 |
|
|
-- THIS TEST IS APPLICABLE FOR IMPLEMENTATIONS WHICH HAVE A
|
43 |
|
|
-- 'MAX_MANTISSA OF 47 OR GREATER.
|
44 |
|
|
|
45 |
|
|
-- IF 'MAX_MANTISSA >= 47 IS NOT SUPPORTED THEN THE DECLARATION OF
|
46 |
|
|
-- 'TYPE FX_OP5' MUST BE REJECTED.
|
47 |
|
|
|
48 |
|
|
-- HISTORY:
|
49 |
|
|
-- NTW 09/08/86 CREATED ORIGINAL TEST.
|
50 |
|
|
-- RJW 11/05/86 REVISED COMMENTS.
|
51 |
|
|
-- DHH 01/13/88 ADDED APPLICABILITY CRITERIA AND STANDARD HEADER.
|
52 |
|
|
-- RDH 04/27/90 REVISED APPLICABILITY CRITERIA.
|
53 |
|
|
|
54 |
|
|
WITH REPORT;
|
55 |
|
|
PROCEDURE C45532P IS
|
56 |
|
|
|
57 |
|
|
USE REPORT;
|
58 |
|
|
|
59 |
|
|
MIN_WORD_LENGTH : CONSTANT := 48;
|
60 |
|
|
FULL_SCALE : CONSTANT := 2 ** (MIN_WORD_LENGTH - 1);
|
61 |
|
|
A_THIRD : CONSTANT := FULL_SCALE / 3;
|
62 |
|
|
RNG1 : CONSTANT := FULL_SCALE * 0.5;
|
63 |
|
|
TYPE FX_0P5 IS DELTA 0.5 RANGE -RNG1 * 1 .. RNG1 * 1 - 0.5;
|
64 |
|
|
-- N/A => ERROR.
|
65 |
|
|
TYPE FX_1 IS DELTA 1.0 RANGE -RNG1 * 2 .. RNG1 * 2 - 1.0;
|
66 |
|
|
TYPE FX_RNG1 IS DELTA RNG1
|
67 |
|
|
RANGE -RNG1 * FULL_SCALE .. RNG1 * (FULL_SCALE - 1);
|
68 |
|
|
|
69 |
|
|
BEGIN TEST ("C45532P", "FIXED POINT OPERATOR ""/""" );
|
70 |
|
|
|
71 |
|
|
--------------------------------------------------
|
72 |
|
|
|
73 |
|
|
-- CASE A) THE OPERATOR /, A, B, AND A / B ALL MODEL NUMBERS.
|
74 |
|
|
|
75 |
|
|
A: DECLARE
|
76 |
|
|
A : FX_RNG1 := 0.0;
|
77 |
|
|
B : FX_0P5 := 0.0;
|
78 |
|
|
RESULT_VALUE : FX_0P5 := 0.0;
|
79 |
|
|
LOWEST_ACCEPTABLE_VALUE : FX_0P5 := FX_0P5 (RNG1 / 2);
|
80 |
|
|
HIGHEST_ACCEPTABLE_VALUE : FX_0P5 := FX_0P5 (RNG1 / 2);
|
81 |
|
|
BEGIN
|
82 |
|
|
IF EQUAL (3, 3) THEN
|
83 |
|
|
A := FX_RNG1 (RNG1 * RNG1 / 4); -- A MODEL NUMBER
|
84 |
|
|
B := FX_0P5 (RNG1 / 2); -- A MODEL NUMBER
|
85 |
|
|
END IF;
|
86 |
|
|
|
87 |
|
|
RESULT_VALUE := FX_0P5 (A / B);
|
88 |
|
|
|
89 |
|
|
IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
|
90 |
|
|
OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
|
91 |
|
|
FAILED ("RESULT OF ""/"" OUTSIDE RESULT MODEL INTERVAL "
|
92 |
|
|
& "WHEN A, B, AND A / B ARE ALL MODEL NUMBERS");
|
93 |
|
|
END IF;
|
94 |
|
|
END A;
|
95 |
|
|
|
96 |
|
|
--------------------------------------------------
|
97 |
|
|
|
98 |
|
|
-- CASE B) THE OPERATOR /, A, B MODEL NUMBERS A / B NOT.
|
99 |
|
|
|
100 |
|
|
B: DECLARE
|
101 |
|
|
A : FX_RNG1 := 0.0;
|
102 |
|
|
B : FX_1 := 0.0;
|
103 |
|
|
RESULT_VALUE : FX_0P5 := 0.0;
|
104 |
|
|
LOWEST_ACCEPTABLE_VALUE : FX_0P5
|
105 |
|
|
:= FX_0P5 (0.5 * A_THIRD);
|
106 |
|
|
HIGHEST_ACCEPTABLE_VALUE : FX_0P5
|
107 |
|
|
:= FX_0P5 (0.5 * (A_THIRD + 1) );
|
108 |
|
|
BEGIN
|
109 |
|
|
IF EQUAL (3, 3) THEN
|
110 |
|
|
A := FX_RNG1 (RNG1); -- A MODEL NUMBER
|
111 |
|
|
B := FX_1 (3.0); -- A MODEL NUMBER
|
112 |
|
|
END IF;
|
113 |
|
|
|
114 |
|
|
RESULT_VALUE := FX_0P5 (A / B);
|
115 |
|
|
|
116 |
|
|
IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
|
117 |
|
|
OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
|
118 |
|
|
FAILED ("RESULT OF ""/"" OUTSIDE RESULT MODEL INTERVAL "
|
119 |
|
|
& "WHEN A, B MODEL NUMBERS A / B NOT");
|
120 |
|
|
END IF;
|
121 |
|
|
END B;
|
122 |
|
|
|
123 |
|
|
--------------------------------------------------
|
124 |
|
|
|
125 |
|
|
-- CASE C) THE OPERATOR /, USING NO MODEL NUMBERS
|
126 |
|
|
|
127 |
|
|
C: DECLARE
|
128 |
|
|
A : FX_RNG1 := 0.0;
|
129 |
|
|
B : FX_1 := 0.0;
|
130 |
|
|
RESULT_VALUE : FX_1 := 0.0;
|
131 |
|
|
LOWEST_ACCEPTABLE_VALUE : FX_1
|
132 |
|
|
:= FX_1 ( RNG1 - 3.0);
|
133 |
|
|
HIGHEST_ACCEPTABLE_VALUE : FX_1
|
134 |
|
|
:= FX_1 ( RNG1 + 4.0);
|
135 |
|
|
BEGIN
|
136 |
|
|
IF EQUAL (3, 3) THEN
|
137 |
|
|
A := FX_RNG1 (RNG1 * RNG1 / 3); -- NOT A MODEL NUMBER
|
138 |
|
|
B := FX_1 (RNG1 / 3); -- NOT A MODEL NUMBER
|
139 |
|
|
END IF;
|
140 |
|
|
|
141 |
|
|
RESULT_VALUE := FX_1 (A / B);
|
142 |
|
|
|
143 |
|
|
IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE)
|
144 |
|
|
OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN
|
145 |
|
|
FAILED ("RESULT OF ""/"" OUTSIDE RESULT MODEL INTERVAL "
|
146 |
|
|
& "WHEN USING NO MODEL NUMBERS");
|
147 |
|
|
END IF;
|
148 |
|
|
END C;
|
149 |
|
|
|
150 |
|
|
--------------------------------------------------
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
RESULT;
|
154 |
|
|
|
155 |
|
|
END C45532P;
|