1-- C46032A.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 CONVERSIONS TO FIXED POINT TYPES WHEN THE OPERAND TYPE
27--     IS A FLOATING POINT TYPE OF 5 DIGITS PRECISION.
28
29-- HISTORY:
30--     JET 07/11/88  CREATED ORIGINAL TEST.
31
32WITH REPORT; USE REPORT;
33PROCEDURE C46032A IS
34
35     TYPE FIX1 IS DELTA 2#0.01# RANGE -16#20.0# .. 16#20.0#;
36     TYPE FIX2 IS DELTA 2#0.0001# RANGE -16#80.0# .. 16#80.0#;
37     TYPE FIX3 IS DELTA 2#0.000001# RANGE -16#200.0# .. 16#200.0#;
38
39     TYPE FLOAT5 IS DIGITS 5;
40
41     F5 : FLOAT5;
42
43     FUNCTION IDENT5 (X : FLOAT5) RETURN FLOAT5 IS
44     BEGIN
45          RETURN X * FLOAT5(IDENT_INT(1));
46     END IDENT5;
47
48BEGIN
49     TEST ("C46032A", "CHECK CONVERSIONS TO FIXED POINT TYPES WHEN " &
50                      "THE OPERAND TYPE IS A FLOATING POINT TYPE " &
51                      "OF 5 DIGITS PRECISION");
52
53     F5 := IDENT5(2#0.1100_0000_0000_0000_00#E0);
54     IF FIX1(F5) /= 16#0.C# THEN
55          FAILED ("INCORRECT RESULT FROM CONVERSION (1)");
56     END IF;
57
58     F5 := IDENT5(2#0.1111_1110_0000_0000_00#E5);
59     IF FIX1(F5) /= 16#1F.C# THEN
60          FAILED ("INCORRECT RESULT FROM CONVERSION (2)");
61     END IF;
62
63     F5 := IDENT5(-2#0.1010_1010_1010_1010_10#E2);
64     IF FIX1(F5) < -16#2.C# OR
65        FIX1(F5) > -16#2.8# THEN
66          FAILED ("INCORRECT RESULT FROM CONVERSION (3)");
67     END IF;
68
69     F5 := IDENT5(2#0.1111_0000_0000_0000_00#E0);
70     IF FIX2(F5) /= 16#0.F# THEN
71          FAILED ("INCORRECT RESULT FROM CONVERSION (4)");
72     END IF;
73
74     F5 := IDENT5(-2#0.1111_1110_0000_0000_00#E7);
75     IF FIX2(F5) /= -16#7F.0# THEN
76          FAILED ("INCORRECT RESULT FROM CONVERSION (5)");
77     END IF;
78
79     F5 := IDENT5(2#0.1111_1111_1101_0000_00#E7);
80     IF FIX2(F5) < 16#7F.E# OR
81        FIX2(F5) > 16#7F.F# THEN
82          FAILED ("INCORRECT RESULT FROM CONVERSION (6)");
83     END IF;
84
85     F5 := IDENT5(2#0.1000_0000_0000_0000_00#E-5);
86     IF FIX3(F5) /= 16#0.04# THEN
87          FAILED ("INCORRECT RESULT FROM CONVERSION (7)");
88     END IF;
89
90     F5 := -IDENT5(2#0.1010_1010_1010_1010_00#E9);
91     IF FIX3(F5) /= -16#155.54# THEN
92          FAILED ("INCORRECT RESULT FROM CONVERSION (8)");
93     END IF;
94
95     F5 := IDENT5(2#0.1000_0000_0000_0010_11#E9);
96     IF FIX3(F5) < 16#100.04# OR
97        FIX3(F5) > 16#100.08# THEN
98          FAILED ("INCORRECT RESULT FROM CONVERSION (9)");
99     END IF;
100
101     RESULT;
102
103END C46032A;
104