1------------------------------------------------------------------------------ 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 for x86) -- 9-- -- 10-- Copyright (C) 1992-2013, 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 80-bit x86 41-- long double format (which is this version), and one using 64-bit IEEE 42-- double (see file a-numaux.ads). 43 44package Ada.Numerics.Aux is 45 pragma Pure; 46 47 pragma Linker_Options ("-lm"); 48 49 type Double is digits 18; 50 51 -- We import these functions directly from C. Note that we label them 52 -- all as pure functions, because indeed all of them are in fact pure. 53 54 function Sin (X : Double) return Double; 55 pragma Import (C, Sin, "sinl"); 56 pragma Pure_Function (Sin); 57 58 function Cos (X : Double) return Double; 59 pragma Import (C, Cos, "cosl"); 60 pragma Pure_Function (Cos); 61 62 function Tan (X : Double) return Double; 63 pragma Import (C, Tan, "tanl"); 64 pragma Pure_Function (Tan); 65 66 function Exp (X : Double) return Double; 67 pragma Import (C, Exp, "expl"); 68 pragma Pure_Function (Exp); 69 70 function Sqrt (X : Double) return Double; 71 pragma Import (C, Sqrt, "sqrtl"); 72 pragma Pure_Function (Sqrt); 73 74 function Log (X : Double) return Double; 75 pragma Import (C, Log, "logl"); 76 pragma Pure_Function (Log); 77 78 function Acos (X : Double) return Double; 79 pragma Import (C, Acos, "acosl"); 80 pragma Pure_Function (Acos); 81 82 function Asin (X : Double) return Double; 83 pragma Import (C, Asin, "asinl"); 84 pragma Pure_Function (Asin); 85 86 function Atan (X : Double) return Double; 87 pragma Import (C, Atan, "atanl"); 88 pragma Pure_Function (Atan); 89 90 function Sinh (X : Double) return Double; 91 pragma Import (C, Sinh, "sinhl"); 92 pragma Pure_Function (Sinh); 93 94 function Cosh (X : Double) return Double; 95 pragma Import (C, Cosh, "coshl"); 96 pragma Pure_Function (Cosh); 97 98 function Tanh (X : Double) return Double; 99 pragma Import (C, Tanh, "tanhl"); 100 pragma Pure_Function (Tanh); 101 102 function Pow (X, Y : Double) return Double; 103 pragma Import (C, Pow, "powl"); 104 pragma Pure_Function (Pow); 105 106end Ada.Numerics.Aux; 107