File : a-nuelfu-cert.ads


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                         GNAT RUNTIME COMPONENTS                          --
   4 --                                                                          --
   5 --     A D A . N U M E R I C S . E L E M E N T A R Y _ F U N C T I O N S    --
   6 --                                                                          --
   7 --                                 S p e c                                  --
   8 --                                                                          --
   9 --          Copyright (C) 1992-2012, Free Software Foundation, Inc.         --
  10 --                                                                          --
  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 3,  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.                                     --
  17 --                                                                          --
  18 --                                                                          --
  19 --                                                                          --
  20 --                                                                          --
  21 --                                                                          --
  22 -- You should have received a copy of the GNU General Public License and    --
  23 -- a copy of the GCC Runtime Library Exception along with this program;     --
  24 -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
  25 -- <http://www.gnu.org/licenses/>.                                          --
  26 --                                                                          --
  27 -- GNAT was originally developed  by the GNAT team at  New York University. --
  28 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
  29 --                                                                          --
  30 ------------------------------------------------------------------------------
  31 
  32 --  This is the Cert specific version of a-ngelfu.adb
  33 
  34 --  The separate version is necessary, because this system does not provide an
  35 --  implementation of tanh, among other hyperbolic functions.
  36 
  37 --  The run time currently has no code to implement this function, so the only
  38 --  short term option was to remove the hyperbolic functions.
  39 
  40 with System.Generic_C_Math_Interface;
  41 
  42 package Ada.Numerics.Elementary_Functions is
  43 pragma Pure (Elementary_Functions);
  44 
  45    function Sqrt    (X           : Float) return Float;
  46    function Log     (X           : Float) return Float;
  47    function Log     (X, Base     : Float) return Float;
  48    function Exp     (X           : Float) return Float;
  49    function "**"    (Left, Right : Float) return Float;
  50 
  51    function Sin     (X           : Float) return Float;
  52    function Sin     (X, Cycle    : Float) return Float;
  53    function Cos     (X           : Float) return Float;
  54    function Cos     (X, Cycle    : Float) return Float;
  55    function Tan     (X           : Float) return Float;
  56    function Tan     (X, Cycle    : Float) return Float;
  57    function Cot     (X           : Float) return Float;
  58    function Cot     (X, Cycle    : Float) return Float;
  59 
  60    function Arcsin  (X           : Float) return Float;
  61    function Arcsin  (X, Cycle    : Float) return Float;
  62    function Arccos  (X           : Float) return Float;
  63    function Arccos  (X, Cycle    : Float) return Float;
  64 
  65    function Arctan
  66      (Y   : Float;
  67       X   : Float := 1.0) return Float;
  68 
  69    function Arctan
  70      (Y     : Float;
  71       X     : Float := 1.0;
  72       Cycle : Float) return  Float;
  73 
  74    function Arccot
  75      (X   : Float;
  76       Y   : Float := 1.0)
  77      return Float;
  78 
  79    function Arccot
  80      (X     : Float;
  81       Y     : Float := 1.0;
  82       Cycle : Float)
  83      return   Float;
  84 
  85 private
  86    pragma Assert (Float'Machine_Radix = 2,
  87       "only binary floating-point types supported");
  88 
  89    function C_Sqrt  (X    : Float) return Float;
  90    function C_Log   (X    : Float) return Float;
  91    function C_Exp   (X    : Float) return Float;
  92    function C_Pow   (X, Y : Float) return Float;
  93 
  94    function C_Sin   (X    : Float) return Float;
  95    function C_Cos   (X    : Float) return Float;
  96    function C_Tan   (X    : Float) return Float;
  97 
  98    function C_Asin  (X    : Float) return Float;
  99    function C_Acos  (X    : Float) return Float;
 100    function C_Atan2 (Y, X : Float) return Float;
 101 
 102    package CMI is new System.Generic_C_Math_Interface (Float);
 103 
 104    function Sqrt    (X           : Float) return Float renames CMI.Sqrt;
 105    function Log     (X           : Float) return Float renames CMI.Log;
 106    function Log     (X, Base     : Float) return Float renames CMI.Log;
 107    function Exp     (X           : Float) return Float renames CMI.Exp;
 108    function "**"    (Left, Right : Float) return Float renames CMI."**";
 109 
 110    function Sin     (X           : Float) return Float renames CMI.Sin;
 111    function Sin     (X, Cycle    : Float) return Float renames CMI.Sin;
 112    function Cos     (X           : Float) return Float renames CMI.Cos;
 113    function Cos     (X, Cycle    : Float) return Float renames CMI.Cos;
 114    function Tan     (X           : Float) return Float renames CMI.Tan;
 115    function Tan     (X, Cycle    : Float) return Float renames CMI.Tan;
 116    function Cot     (X           : Float) return Float renames CMI.Cot;
 117    function Cot     (X, Cycle    : Float) return Float renames CMI.Cot;
 118 
 119    function Arcsin  (X           : Float) return Float renames CMI.Arcsin;
 120    function Arcsin  (X, Cycle    : Float) return Float renames CMI.Arcsin;
 121    function Arccos  (X           : Float) return Float renames CMI.Arccos;
 122    function Arccos  (X, Cycle    : Float) return Float renames CMI.Arccos;
 123 
 124    function Arctan
 125      (Y   : Float;
 126       X   : Float := 1.0) return Float
 127      renames CMI.Arctan;
 128 
 129    function Arctan
 130      (Y     : Float;
 131       X     : Float := 1.0;
 132       Cycle : Float) return Float
 133      renames CMI.Arctan;
 134 
 135    function Arccot
 136      (X   : Float;
 137       Y   : Float := 1.0) return Float
 138      renames CMI.Arccot;
 139 
 140    function Arccot
 141      (X     : Float;
 142       Y     : Float := 1.0;
 143       Cycle : Float) return Float
 144      renames CMI.Arccot;
 145 
 146 end Ada.Numerics.Elementary_Functions;