1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- S Y S T E M . V A X _ F L O A T _ O P E R A T I O N S --
9 -- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
32 ------------------------------------------------------------------------------
34 -- This is a dummy body for use on non-Alpha systems so that the library
35 -- can compile. This dummy version uses ordinary conversions and other
36 -- arithmetic operations. it is used only for testing purposes in the
37 -- case where the -gnatdm switch is used to force testing of VMS features
38 -- on non-VMS systems.
40 with System
.IO
; use System
.IO
;
42 package body System
.Vax_Float_Operations
is
43 pragma Warnings
(Off
);
44 -- Warnings about infinite recursion when the -gnatdm switch is used
50 function Abs_F
(X
: F
) return F
is
59 function Abs_G
(X
: G
) return G
is
68 function Add_F
(X
, Y
: F
) return F
is
77 function Add_G
(X
, Y
: G
) return G
is
86 function D_To_G
(X
: D
) return G
is
95 procedure Debug_Output_D
(Arg
: D
) is
104 procedure Debug_Output_F
(Arg
: F
) is
113 procedure Debug_Output_G
(Arg
: G
) is
122 Debug_String_Buffer
: String (1 .. 32);
123 -- Buffer used by all Debug_String_x routines for returning result
125 function Debug_String_D
(Arg
: D
) return System
.Address
is
126 Image_String
: constant String := D
'Image (Arg
) & ASCII
.NUL
;
127 Image_Size
: constant Integer := Image_String
'Length;
130 Debug_String_Buffer
(1 .. Image_Size
) := Image_String
;
131 return Debug_String_Buffer
(1)'Address;
138 function Debug_String_F
(Arg
: F
) return System
.Address
is
139 Image_String
: constant String := F
'Image (Arg
) & ASCII
.NUL
;
140 Image_Size
: constant Integer := Image_String
'Length;
143 Debug_String_Buffer
(1 .. Image_Size
) := Image_String
;
144 return Debug_String_Buffer
(1)'Address;
151 function Debug_String_G
(Arg
: G
) return System
.Address
is
152 Image_String
: constant String := G
'Image (Arg
) & ASCII
.NUL
;
153 Image_Size
: constant Integer := Image_String
'Length;
156 Debug_String_Buffer
(1 .. Image_Size
) := Image_String
;
157 return Debug_String_Buffer
(1)'Address;
164 function Div_F
(X
, Y
: F
) return F
is
173 function Div_G
(X
, Y
: G
) return G
is
182 function Eq_F
(X
, Y
: F
) return Boolean is
191 function Eq_G
(X
, Y
: G
) return Boolean is
200 function F_To_G
(X
: F
) return G
is
209 function F_To_Q
(X
: F
) return Q
is
218 function F_To_S
(X
: F
) return S
is
227 function G_To_D
(X
: G
) return D
is
236 function G_To_F
(X
: G
) return F
is
245 function G_To_Q
(X
: G
) return Q
is
254 function G_To_T
(X
: G
) return T
is
263 function Le_F
(X
, Y
: F
) return Boolean is
272 function Le_G
(X
, Y
: G
) return Boolean is
281 function Lt_F
(X
, Y
: F
) return Boolean is
290 function Lt_G
(X
, Y
: G
) return Boolean is
299 function Mul_F
(X
, Y
: F
) return F
is
308 function Mul_G
(X
, Y
: G
) return G
is
317 function Ne_F
(X
, Y
: F
) return Boolean is
326 function Ne_G
(X
, Y
: G
) return Boolean is
335 function Neg_F
(X
: F
) return F
is
344 function Neg_G
(X
: G
) return G
is
353 procedure pd
(Arg
: D
) is
355 Put_Line
(D
'Image (Arg
));
362 procedure pf
(Arg
: F
) is
364 Put_Line
(F
'Image (Arg
));
371 procedure pg
(Arg
: G
) is
373 Put_Line
(G
'Image (Arg
));
380 function Q_To_F
(X
: Q
) return F
is
389 function Q_To_G
(X
: Q
) return G
is
398 function S_To_F
(X
: S
) return F
is
407 function Sub_F
(X
, Y
: F
) return F
is
416 function Sub_G
(X
, Y
: G
) return G
is
425 function T_To_D
(X
: T
) return D
is
427 return G_To_D
(T_To_G
(X
));
434 function T_To_G
(X
: T
) return G
is
443 -- For now, convert to IEEE and do Valid test on result. This is not quite
444 -- accurate, but is good enough in practice.
446 function Valid_D
(Arg
: D
) return Boolean is
447 Val
: constant T
:= G_To_T
(D_To_G
(Arg
));
456 -- For now, convert to IEEE and do Valid test on result. This is not quite
457 -- accurate, but is good enough in practice.
459 function Valid_F
(Arg
: F
) return Boolean is
460 Val
: constant S
:= F_To_S
(Arg
);
469 -- For now, convert to IEEE and do Valid test on result. This is not quite
470 -- accurate, but is good enough in practice.
472 function Valid_G
(Arg
: G
) return Boolean is
473 Val
: constant T
:= G_To_T
(Arg
);
478 end System
.Vax_Float_Operations
;