]>
Commit | Line | Data |
---|---|---|
d23b8f57 RK |
1 | ------------------------------------------------------------------------------ |
2 | -- -- | |
3084fecd | 3 | -- GNAT RUN-TIME COMPONENTS -- |
d23b8f57 RK |
4 | -- -- |
5 | -- A D A . N U M E R I C S . A U X -- | |
6 | -- -- | |
7 | -- S p e c -- | |
8 | -- (C Library Version, non-x86) -- | |
d23b8f57 | 9 | -- -- |
748086b7 | 10 | -- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- |
d23b8f57 RK |
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- -- | |
748086b7 | 14 | -- ware Foundation; either version 3, or (at your option) any later ver- -- |
d23b8f57 RK |
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 -- | |
748086b7 JJ |
17 | -- or FITNESS FOR A PARTICULAR PURPOSE. -- |
18 | -- -- | |
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. -- | |
22 | -- -- | |
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/>. -- | |
d23b8f57 RK |
27 | -- -- |
28 | -- GNAT was originally developed by the GNAT team at New York University. -- | |
71ff80dc | 29 | -- Extensive contributions were provided by Ada Core Technologies Inc. -- |
d23b8f57 RK |
30 | -- -- |
31 | ------------------------------------------------------------------------------ | |
32 | ||
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. | |
37 | -- One advantage of using this package is that it will interface directly to | |
38 | -- hardware instructions, such as the those provided on the Intel x86. | |
39 | ||
91b1417d AC |
40 | -- This version is for use with normal Unix math functions. Alternative |
41 | -- packages are used on OpenVMS (different import names), VxWorks (no | |
42 | -- need for the -lm Linker_Options), and on the x86 (where we have two | |
43 | -- versions one using inline ASM, and one importing from the C long | |
44 | -- routines that take 80-bit arguments). | |
d23b8f57 RK |
45 | |
46 | package Ada.Numerics.Aux is | |
009186e0 | 47 | pragma Pure; |
d23b8f57 RK |
48 | |
49 | pragma Linker_Options ("-lm"); | |
50 | ||
51 | type Double is digits 15; | |
91b1417d AC |
52 | -- Type Double is the type used to call the C routines |
53 | ||
54 | -- We import these functions directly from C. Note that we label them | |
55 | -- all as pure functions, because indeed all of them are in fact pure! | |
d23b8f57 RK |
56 | |
57 | function Sin (X : Double) return Double; | |
58 | pragma Import (C, Sin, "sin"); | |
91b1417d | 59 | pragma Pure_Function (Sin); |
d23b8f57 RK |
60 | |
61 | function Cos (X : Double) return Double; | |
62 | pragma Import (C, Cos, "cos"); | |
91b1417d | 63 | pragma Pure_Function (Cos); |
d23b8f57 RK |
64 | |
65 | function Tan (X : Double) return Double; | |
66 | pragma Import (C, Tan, "tan"); | |
91b1417d | 67 | pragma Pure_Function (Tan); |
d23b8f57 RK |
68 | |
69 | function Exp (X : Double) return Double; | |
70 | pragma Import (C, Exp, "exp"); | |
91b1417d | 71 | pragma Pure_Function (Exp); |
d23b8f57 RK |
72 | |
73 | function Sqrt (X : Double) return Double; | |
74 | pragma Import (C, Sqrt, "sqrt"); | |
91b1417d | 75 | pragma Pure_Function (Sqrt); |
d23b8f57 RK |
76 | |
77 | function Log (X : Double) return Double; | |
78 | pragma Import (C, Log, "log"); | |
91b1417d | 79 | pragma Pure_Function (Log); |
d23b8f57 RK |
80 | |
81 | function Acos (X : Double) return Double; | |
82 | pragma Import (C, Acos, "acos"); | |
91b1417d | 83 | pragma Pure_Function (Acos); |
d23b8f57 RK |
84 | |
85 | function Asin (X : Double) return Double; | |
86 | pragma Import (C, Asin, "asin"); | |
91b1417d | 87 | pragma Pure_Function (Asin); |
d23b8f57 RK |
88 | |
89 | function Atan (X : Double) return Double; | |
90 | pragma Import (C, Atan, "atan"); | |
91b1417d | 91 | pragma Pure_Function (Atan); |
d23b8f57 RK |
92 | |
93 | function Sinh (X : Double) return Double; | |
94 | pragma Import (C, Sinh, "sinh"); | |
91b1417d | 95 | pragma Pure_Function (Sinh); |
d23b8f57 RK |
96 | |
97 | function Cosh (X : Double) return Double; | |
98 | pragma Import (C, Cosh, "cosh"); | |
91b1417d | 99 | pragma Pure_Function (Cosh); |
d23b8f57 RK |
100 | |
101 | function Tanh (X : Double) return Double; | |
102 | pragma Import (C, Tanh, "tanh"); | |
91b1417d | 103 | pragma Pure_Function (Tanh); |
d23b8f57 RK |
104 | |
105 | function Pow (X, Y : Double) return Double; | |
106 | pragma Import (C, Pow, "pow"); | |
91b1417d | 107 | pragma Pure_Function (Pow); |
d23b8f57 RK |
108 | |
109 | end Ada.Numerics.Aux; |