1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S Y S T E M . F A T _ G E N --
11 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
34 ------------------------------------------------------------------------------
36 -- This generic package provides a target independent implementation of the
37 -- floating-point attributes that denote functions. The implementations here
38 -- are portable, but very slow. The runtime contains a set of instantiations
39 -- of this package for all predefined floating-point types, and these should
40 -- be replaced by efficient assembly language code where possible.
45 package System.Fat_Gen is
46 pragma Pure (Fat_Gen);
48 subtype UI is Integer;
49 -- The runtime representation of universal integer for the purposes of
50 -- this package is integer. The expander generates conversions for the
51 -- actual type used. For functions returning universal integer, there
52 -- is no problem, since the result always is in range of integer. For
53 -- input arguments, the expander has to do some special casing to deal
54 -- with the (very annoying!) cases of out of range values. If we used
55 -- Long_Long_Integer to represent universal, then there would be no
56 -- problem, but the resulting inefficiency would be annoying.
58 function Adjacent (X, Towards : T) return T;
60 function Ceiling (X : T) return T;
62 function Compose (Fraction : T; Exponent : UI) return T;
64 function Copy_Sign (Value, Sign : T) return T;
66 function Exponent (X : T) return UI;
68 function Floor (X : T) return T;
70 function Fraction (X : T) return T;
72 function Leading_Part (X : T; Radix_Digits : UI) return T;
74 function Machine (X : T) return T;
76 function Model (X : T) return T;
78 function Pred (X : T) return T;
80 function Remainder (X, Y : T) return T;
82 function Rounding (X : T) return T;
84 function Scaling (X : T; Adjustment : UI) return T;
86 function Succ (X : T) return T;
88 function Truncation (X : T) return T;
90 function Unbiased_Rounding (X : T) return T;
92 function Valid (X : access T) return Boolean;
93 -- The argument must be passed by reference here, as T may be
94 -- an abnormal value that can be passed in a floating point register.
97 pragma Inline (Machine);
98 pragma Inline (Model);
99 pragma Inline_Always (Valid);