1-- C45531O.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 MIXED FIXED POINT AND INTEGER TYPES USING 4 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) INTEGER * FIXED WHEN ALL VALUES ARE MODEL NUMBERS. 34-- B) FIXED * INTEGER WHEN ALL VALUES ARE MODEL NUMBERS. 35-- C) INTEGER * FIXED FOR NON-MODEL NUMBERS. 36-- D) FIXED * INTEGER FOR NON-MODEL NUMBERS. 37-- 38-- REPEAT FOR MINIMUM REQUIRED WORD LENGTHS OF 12, 16, 32 AND 48, 39-- WITH RANGE <, =, AND > THAN 1.0 AND 40-- WITH DELTA <, =, AND > THAN 1.0. 41 42-- APPLICABILITY CRITERIA: 43-- THIS TEST IS APPLICABLE FOR IMPLEMENTATIONS WHICH HAVE A 44-- 'MAX_MANTISSA OF 47 OR GREATER. 45 46-- IF 'MAX_MANTISSA >= 47 IS NOT SUPPORTED THEN THE DECLARATION OF 47-- 'TYPE FX_OP5' MUST BE REJECTED. 48 49-- HISTORY: 50-- NTW 09/08/86 CREATED ORIGINAL TEST. 51-- RJW 11/05/86 REVISED COMMENTS. 52-- DHH 01/13/88 ADDED APPLICABILITY CRITERIA AND STANDARD HEADER. 53-- BCB 04/27/90 REVISED APPLICABILITY CRITERIA. 54 55WITH REPORT; 56PROCEDURE C45531O IS 57 58 USE REPORT; 59 60 MIN_WORD_LENGTH : CONSTANT := 48; 61 FULL_SCALE : CONSTANT := 2 ** (MIN_WORD_LENGTH - 1); 62 FORTH : CONSTANT := FULL_SCALE / 4; 63 RNG1 : CONSTANT := FULL_SCALE * 0.5; 64 TYPE FX_0P5 IS DELTA 0.5 RANGE -RNG1 * 1 .. RNG1 * 1 - 0.5; 65 -- N/A => ERROR. 66 TYPE FX_1 IS DELTA 1.0 RANGE -RNG1 * 2 .. RNG1 * 2 - 1.0; 67 TYPE FX_RNG1 IS DELTA RNG1 68 RANGE -RNG1 * FULL_SCALE .. RNG1 * (FULL_SCALE - 1); 69 70BEGIN TEST ("C45531O", "MIXED FIXED POINT AND INTEGER ""*"" " 71 & "FOR DELTA <, =, > 1.0"); 72 73 -------------------------------------------------- 74 75 -- CASE A) INTEGER * FIXED WHEN ALL VALUES ARE MODEL NUMBERS. 76 77A: DECLARE 78 A : INTEGER := 0; 79 B : FX_0P5 := 0.0; 80 RESULT_VALUE : FX_0P5 := 0.0; 81 LOWEST_ACCEPTABLE_VALUE : FX_0P5 := FX_0P5 (7.5); 82 HIGHEST_ACCEPTABLE_VALUE : FX_0P5 := FX_0P5 (7.5); 83 BEGIN 84 IF EQUAL (3, 3) THEN 85 A := 3; 86 B := FX_0P5 (2.5); -- A MODEL NUMBER 87 END IF; 88 89 RESULT_VALUE := A * B; 90 91 IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE) 92 OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN 93 FAILED ("RESULT OF ""*"" OUTSIDE RESULT MODEL INTERVAL " 94 & "FOR INTEGER * FIXED " 95 & "WHEN ALL VALUES ARE MODEL NUMBERS"); 96 END IF; 97 END A; 98 99 -------------------------------------------------- 100 101 -- CASE B) FIXED * INTEGER WHEN ALL VALUES ARE MODEL NUMBERS. 102 103B: DECLARE 104 A : FX_1 := 0.0; 105 B : INTEGER := 0; 106 RESULT_VALUE : FX_1 := 0.0; 107 LOWEST_ACCEPTABLE_VALUE : FX_1 := FX_1 (3 * FORTH); 108 HIGHEST_ACCEPTABLE_VALUE : FX_1 := FX_1 (3 * FORTH); 109 BEGIN 110 IF EQUAL (3, 3) THEN 111 A := FX_1 (FULL_SCALE / 8); -- A MODEL NUMBER 112 B := 6; 113 END IF; 114 115 RESULT_VALUE := A * B; 116 117 IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE) 118 OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN 119 FAILED ("RESULT OF ""*"" OUTSIDE RESULT MODEL INTERVAL " 120 & "FOR FIXED * INTEGER " 121 & "WHEN ALL VALUES ARE MODEL NUMBERS"); 122 END IF; 123 END B; 124 125 -------------------------------------------------- 126 127 -- CASE C) INTEGER * FIXED FOR NON-MODEL NUMBERS. 128 129C: DECLARE 130 A : INTEGER := 0; 131 B : FX_RNG1 := 0.0; 132 RESULT_VALUE : FX_RNG1 := 0.0; 133 LOW_COUNT : CONSTANT := (3 * (FORTH + 0) ); 134 HIGH_COUNT : CONSTANT := (3 * (FORTH + 1) ); 135 LOWEST_ACCEPTABLE_VALUE : FX_RNG1 136 := FX_RNG1 (RNG1 * LOW_COUNT ); 137 HIGHEST_ACCEPTABLE_VALUE : FX_RNG1 138 := FX_RNG1 (RNG1 * HIGH_COUNT); 139 BEGIN 140 IF EQUAL (3, 3) THEN -- B NOT A MODEL NUMBER 141 A := 3; 142 B := FX_RNG1 (RNG1 * FORTH + 0.5); 143 END IF; 144 145 RESULT_VALUE := A * B; 146 147 IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE) 148 OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN 149 FAILED ("RESULT OF ""*"" OUTSIDE RESULT MODEL INTERVAL " 150 & "FOR INTEGER * FIXED FOR NON-MODEL NUMBERS"); 151 152 END IF; 153 END C; 154 155 -------------------------------------------------- 156 157 -- CASE D) FIXED * INTEGER FOR NON-MODEL NUMBERS. 158 159D: DECLARE 160 A : FX_RNG1 := 0.0; 161 B : INTEGER := 0; 162 RESULT_VALUE : FX_RNG1 := 0.0; 163 LOW_COUNT : CONSTANT := (3 * (FORTH + 0) ); 164 HIGH_COUNT : CONSTANT := (3 * (FORTH + 1) ); 165 LOWEST_ACCEPTABLE_VALUE : FX_RNG1 166 := FX_RNG1 (RNG1 * LOW_COUNT ); 167 HIGHEST_ACCEPTABLE_VALUE : FX_RNG1 168 := FX_RNG1 (RNG1 * HIGH_COUNT); 169 BEGIN 170 IF EQUAL (3, 3) THEN -- A NOT A MODEL NUMBER 171 A := FX_RNG1 (RNG1 * FORTH + 0.5); 172 B := 3; 173 END IF; 174 175 RESULT_VALUE := A * B; 176 177 IF (RESULT_VALUE < LOWEST_ACCEPTABLE_VALUE) 178 OR (RESULT_VALUE > HIGHEST_ACCEPTABLE_VALUE) THEN 179 FAILED ("RESULT OF ""*"" OUTSIDE RESULT MODEL INTERVAL " 180 & "FOR FIXED * INTEGER FOR NON-MODEL NUMBERS"); 181 END IF; 182 END D; 183 184 -------------------------------------------------- 185 186 187 RESULT; 188 189END C45531O; 190