1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- A D A . N U M E R I C S . A U X --
10 -- Copyright (C) 2003-2010, Free Software Foundation, Inc. --
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 3, 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. --
19 -- As a special exception under Section 7 of GPL version 3, you are granted --
20 -- additional permissions described in the GCC Runtime Library Exception, --
21 -- version 3.1, as published by the Free Software Foundation. --
23 -- You should have received a copy of the GNU General Public License and --
24 -- a copy of the GCC Runtime Library Exception along with this program; --
25 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
26 -- <http://www.gnu.org/licenses/>. --
28 -- GNAT was originally developed by the GNAT team at New York University. --
29 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 ------------------------------------------------------------------------------
33 -- This package provides the basic computational interface for the generic
34 -- elementary functions. The C library version interfaces with the routines
35 -- in the C mathematical library, and is thus quite portable, although it may
36 -- not necessarily meet the requirements for accuracy in the numerics annex.
38 -- This is the VMS version
40 package Ada
.Numerics
.Aux
is
43 type Double
is digits 15;
44 pragma Float_Representation
(IEEE_Float
, Double
);
45 -- Type Double is the type used to call the C routines. Note that this
46 -- is IEEE format even when running on VMS with VAX_Native representation
47 -- since we use the IEEE version of the C library with VMS.
49 -- We import these functions directly from C. Note that we label them
50 -- all as pure functions, because indeed all of them are in fact pure!
52 function Sin
(X
: Double
) return Double
;
53 pragma Import
(C
, Sin
, "MATH$SIN_T");
54 pragma Pure_Function
(Sin
);
56 function Cos
(X
: Double
) return Double
;
57 pragma Import
(C
, Cos
, "MATH$COS_T");
58 pragma Pure_Function
(Cos
);
60 function Tan
(X
: Double
) return Double
;
61 pragma Import
(C
, Tan
, "MATH$TAN_T");
62 pragma Pure_Function
(Tan
);
64 function Exp
(X
: Double
) return Double
;
65 pragma Import
(C
, Exp
, "MATH$EXP_T");
66 pragma Pure_Function
(Exp
);
68 function Sqrt
(X
: Double
) return Double
;
69 pragma Import
(C
, Sqrt
, "MATH$SQRT_T");
70 pragma Pure_Function
(Sqrt
);
72 function Log
(X
: Double
) return Double
;
73 pragma Import
(C
, Log
, "DECC$TLOG_2");
74 pragma Pure_Function
(Log
);
76 function Acos
(X
: Double
) return Double
;
77 pragma Import
(C
, Acos
, "MATH$ACOS_T");
78 pragma Pure_Function
(Acos
);
80 function Asin
(X
: Double
) return Double
;
81 pragma Import
(C
, Asin
, "MATH$ASIN_T");
82 pragma Pure_Function
(Asin
);
84 function Atan
(X
: Double
) return Double
;
85 pragma Import
(C
, Atan
, "MATH$ATAN_T");
86 pragma Pure_Function
(Atan
);
88 function Sinh
(X
: Double
) return Double
;
89 pragma Import
(C
, Sinh
, "MATH$SINH_T");
90 pragma Pure_Function
(Sinh
);
92 function Cosh
(X
: Double
) return Double
;
93 pragma Import
(C
, Cosh
, "MATH$COSH_T");
94 pragma Pure_Function
(Cosh
);
96 function Tanh
(X
: Double
) return Double
;
97 pragma Import
(C
, Tanh
, "MATH$TANH_T");
98 pragma Pure_Function
(Tanh
);
100 function Pow
(X
, Y
: Double
) return Double
;
101 pragma Import
(C
, Pow
, "DECC$TPOW_2");
102 pragma Pure_Function
(Pow
);
104 end Ada
.Numerics
.Aux
;