1 |
281 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT RUN-TIME COMPONENTS --
|
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, VxWorks) --
|
9 |
|
|
-- --
|
10 |
|
|
-- Copyright (C) 1992-2009, 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 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. --
|
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/>. --
|
27 |
|
|
-- --
|
28 |
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
29 |
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
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 |
|
|
|
40 |
|
|
-- Note: there are two versions of this package. One using the normal IEEE
|
41 |
|
|
-- 64-bit double format (which is this version), and one using 80-bit x86
|
42 |
|
|
-- long double (see file 4onumaux.ads).
|
43 |
|
|
|
44 |
|
|
package Ada.Numerics.Aux is
|
45 |
|
|
pragma Pure;
|
46 |
|
|
|
47 |
|
|
-- This version omits the pragma linker_options ("-lm") since there is
|
48 |
|
|
-- no libm.a library for VxWorks.
|
49 |
|
|
|
50 |
|
|
type Double is digits 15;
|
51 |
|
|
-- Type Double is the type used to call the C routines
|
52 |
|
|
|
53 |
|
|
-- We import these functions directly from C. Note that we label them
|
54 |
|
|
-- all as pure functions, because indeed all of them are in fact pure!
|
55 |
|
|
|
56 |
|
|
function Sin (X : Double) return Double;
|
57 |
|
|
pragma Import (C, Sin, "sin");
|
58 |
|
|
pragma Pure_Function (Sin);
|
59 |
|
|
|
60 |
|
|
function Cos (X : Double) return Double;
|
61 |
|
|
pragma Import (C, Cos, "cos");
|
62 |
|
|
pragma Pure_Function (Cos);
|
63 |
|
|
|
64 |
|
|
function Tan (X : Double) return Double;
|
65 |
|
|
pragma Import (C, Tan, "tan");
|
66 |
|
|
pragma Pure_Function (Tan);
|
67 |
|
|
|
68 |
|
|
function Exp (X : Double) return Double;
|
69 |
|
|
pragma Import (C, Exp, "exp");
|
70 |
|
|
pragma Pure_Function (Exp);
|
71 |
|
|
|
72 |
|
|
function Sqrt (X : Double) return Double;
|
73 |
|
|
pragma Import (C, Sqrt, "sqrt");
|
74 |
|
|
pragma Pure_Function (Sqrt);
|
75 |
|
|
|
76 |
|
|
function Log (X : Double) return Double;
|
77 |
|
|
pragma Import (C, Log, "log");
|
78 |
|
|
pragma Pure_Function (Log);
|
79 |
|
|
|
80 |
|
|
function Acos (X : Double) return Double;
|
81 |
|
|
pragma Import (C, Acos, "acos");
|
82 |
|
|
pragma Pure_Function (Acos);
|
83 |
|
|
|
84 |
|
|
function Asin (X : Double) return Double;
|
85 |
|
|
pragma Import (C, Asin, "asin");
|
86 |
|
|
pragma Pure_Function (Asin);
|
87 |
|
|
|
88 |
|
|
function Atan (X : Double) return Double;
|
89 |
|
|
pragma Import (C, Atan, "atan");
|
90 |
|
|
pragma Pure_Function (Atan);
|
91 |
|
|
|
92 |
|
|
function Sinh (X : Double) return Double;
|
93 |
|
|
pragma Import (C, Sinh, "sinh");
|
94 |
|
|
pragma Pure_Function (Sinh);
|
95 |
|
|
|
96 |
|
|
function Cosh (X : Double) return Double;
|
97 |
|
|
pragma Import (C, Cosh, "cosh");
|
98 |
|
|
pragma Pure_Function (Cosh);
|
99 |
|
|
|
100 |
|
|
function Tanh (X : Double) return Double;
|
101 |
|
|
pragma Import (C, Tanh, "tanh");
|
102 |
|
|
pragma Pure_Function (Tanh);
|
103 |
|
|
|
104 |
|
|
function Pow (X, Y : Double) return Double;
|
105 |
|
|
pragma Import (C, Pow, "pow");
|
106 |
|
|
pragma Pure_Function (Pow);
|
107 |
|
|
|
108 |
|
|
end Ada.Numerics.Aux;
|