OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c3/] [c35902d.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C35902D.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
-- CHECK THAT THE BINARY POINT IN THE MANTISSA OF A FIXED POINT NUMBER
26
-- CAN LIE OUTSIDE THE MANTISSA (EITHER TO THE LEFT OR TO THE RIGHT).
27
 
28
-- WRG 7/18/86
29
 
30
WITH REPORT; USE REPORT;
31
WITH SYSTEM; USE SYSTEM;
32
PROCEDURE C35902D IS
33
 
34
BEGIN
35
 
36
     TEST ("C35902D", "CHECK THAT THE BINARY POINT IN THE MANTISSA " &
37
                      "OF A FIXED POINT NUMBER CAN LIE OUTSIDE THE " &
38
                      "MANTISSA (EITHER TO THE LEFT OR TO THE RIGHT)");
39
 
40
     COMMENT ("VALUE OF SYSTEM.MAX_MANTISSA IS" &
41
              POSITIVE'IMAGE(MAX_MANTISSA) );
42
 
43
  A: DECLARE
44
 
45
          RS : CONSTANT := 2.0;
46
 
47
          TYPE ONE_TO_THE_RIGHT IS
48
               DELTA RS
49
               RANGE -(2.0 ** (MAX_MANTISSA+1) ) ..
50
                       2.0 ** (MAX_MANTISSA+1);
51
               -- THE BINARY POINT IS ONE PLACE TO THE RIGHT OF THE
52
               -- LARGEST POSSIBLE MANTISSA.
53
 
54
          R1, R2 : ONE_TO_THE_RIGHT;
55
 
56
     BEGIN
57
 
58
          R1 := RS;
59
          FOR I IN POSITIVE RANGE 1 .. MAX_MANTISSA - 1 LOOP
60
               R1 := R1 * IDENT_INT (2);
61
          END LOOP;
62
          R2 := R1 - RS;
63
          R2 := R2 + R1;
64
          -- AT THIS POINT, R2 SHOULD EQUAL ONE_TO_THE_RIGHT'LARGE.
65
          R2 := -R2;
66
          R2 := R2 + (R1 - RS);
67
          FOR I IN POSITIVE RANGE 1 .. MAX_MANTISSA - 1 LOOP
68
               R2 := R2 / IDENT_INT (2);
69
          END LOOP;
70
          IF R2 /= -RS THEN
71
               FAILED ("IDENTITY-PRESERVING OPERATIONS ARE FLAKY - A");
72
          END IF;
73
 
74
     EXCEPTION
75
 
76
          WHEN OTHERS =>
77
               FAILED ("EXCEPTION RAISED - A");
78
 
79
     END A;
80
 
81
  B: DECLARE
82
 
83
          LS : CONSTANT := 2.0 ** (-(MAX_MANTISSA+1) );
84
 
85
          TYPE ONE_TO_THE_LEFT IS
86
               DELTA LS
87
               RANGE -(2.0 ** (-1) ) ..
88
                       2.0 ** (-1);
89
               -- THE BINARY POINT IS ONE PLACE TO THE LEFT OF THE
90
               -- LARGEST POSSIBLE MANTISSA.
91
 
92
          L1, L2 : ONE_TO_THE_LEFT;
93
 
94
     BEGIN
95
 
96
          L1 := LS;
97
          FOR I IN POSITIVE RANGE 1 .. MAX_MANTISSA - 1 LOOP
98
               L1 := L1 * IDENT_INT (2);
99
          END LOOP;
100
          L2 := L1 - LS;
101
          L2 := L2 + L1;
102
          -- AT THIS POINT, L2 SHOULD EQUAL ONE_TO_THE_LEFT'LARGE.
103
          L2 := -L2;
104
          L2 := L2 + (L1 - LS);
105
          FOR I IN POSITIVE RANGE 1 .. MAX_MANTISSA - 1 LOOP
106
               L2 := L2 / IDENT_INT (2);
107
          END LOOP;
108
          IF L2 /= -LS THEN
109
               FAILED ("IDENTITY-PRESERVING OPERATIONS ARE FLAKY - B");
110
          END IF;
111
 
112
     EXCEPTION
113
 
114
          WHEN OTHERS =>
115
               FAILED ("EXCEPTION RAISED - B");
116
 
117
     END B;
118
 
119
     RESULT;
120
 
121
END C35902D;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.