OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gnat.dg/] [conv_decimal.adb] - Blame information for rev 304

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 304 jeremybenn
-- PR middle-end/36575
2
-- reporter: Laurent Guerby <laurent@guerby.net>
3
-- { dg-do run }
4
 
5
procedure Conv_Decimal is
6
 
7
  type Unsigned_Over_8 is mod 2**8+2;
8
  type Signed_Over_8 is range -200 .. 200;
9
 
10
  procedure Assert(Truth: Boolean) is
11
  begin
12
    if not Truth then
13
      raise Program_Error;
14
    end if;
15
  end;
16
 
17
  type Decim is delta 0.1 digits 5;
18
 
19
  Halfway  : Decim := 2.5;
20
  Neg_Half : Decim := -2.5;
21
 
22
  Big      : Unsigned_Over_8;
23
  Also_Big : Signed_Over_8;
24
 
25
begin
26
  Big := Unsigned_Over_8 (Halfway); -- Rounds up by 4.6(33).
27
  Assert(Big = 3);
28
 
29
  Also_Big := Signed_Over_8 (Halfway); -- Rounds up by 4.6(33).
30
  Assert(Also_Big = 3);
31
 
32
  Also_Big := Signed_Over_8 (Neg_Half); -- Rounds down by 4.6(33).
33
  Assert(Also_Big = -3);
34
end;

powered by: WebSVN 2.1.0

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