OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / ada / eval_fat.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             E V A L _ F A T                              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                                                                          --
10 --          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
11 --                                                                          --
12 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
13 -- terms of the  GNU General Public License as published  by the Free Soft- --
14 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
15 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
18 -- for  more details.  You should have  received  a copy of the GNU General --
19 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
20 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
21 -- MA 02111-1307, USA.                                                      --
22 --                                                                          --
23 -- GNAT was originally developed  by the GNAT team at  New York University. --
24 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
25 --                                                                          --
26 ------------------------------------------------------------------------------
27
28 --  This package provides for compile-time evaluation of static calls to the
29 --  floating-point attribute functions. It is the compile-time equivalent of
30 --  the System.Fat_Gen runtime package. The coding is quite similar, as are
31 --  the subprogram specs, except that the type is passed as an explicit
32 --  first parameter (and used via ttypes, to obtain the necessary information
33 --  about the characteristics of the type for computing the results.
34
35 with Types;  use Types;
36 with Uintp;  use Uintp;
37 with Urealp; use Urealp;
38
39 package Eval_Fat is
40
41    subtype UI is Uint;
42    --  The compile time representation of universal integer
43
44    subtype T is Ureal;
45    --  The compile time representation of floating-point values
46
47    subtype R is Entity_Id;
48    --  The compile time representation of the floating-point root type
49
50    type Rounding_Mode is (Floor, Ceiling, Round, Round_Even);
51    for Rounding_Mode use (0, 1, 2, 3);
52    --  Used to indicate rounding mode for Machine attribute
53    --  Note that C code in gigi knows that Round_Even is 3
54
55    Rounding_Was_Biased : Boolean;
56    --  Set if last use of Machine rounded a halfway case away from zero
57
58    function Adjacent          (RT : R; X, Towards : T)              return T;
59
60    function Ceiling           (RT : R; X : T)                       return T;
61
62    function Compose           (RT : R; Fraction : T; Exponent : UI) return T;
63
64    function Copy_Sign         (RT : R; Value, Sign : T)             return T;
65
66    function Exponent          (RT : R; X : T)                       return UI;
67
68    function Floor             (RT : R; X : T)                       return T;
69
70    function Fraction          (RT : R; X : T)                       return T;
71
72    function Leading_Part      (RT : R; X : T; Radix_Digits : UI)    return T;
73
74    function Machine           (RT : R; X : T; Mode : Rounding_Mode) return T;
75
76    function Model             (RT : R; X : T)                       return T;
77
78    function Pred              (RT : R; X : T)                       return T;
79
80    function Remainder         (RT : R; X, Y : T)                    return T;
81
82    function Rounding          (RT : R; X : T)                       return T;
83
84    function Scaling           (RT : R; X : T; Adjustment : UI)      return T;
85
86    function Succ              (RT : R; X : T)                       return T;
87
88    function Truncation        (RT : R; X : T)                       return T;
89
90    function Unbiased_Rounding (RT : R; X : T)                       return T;
91
92 end Eval_Fat;