phcpack_2.4.88_e448e94a/src/Ada/Math_Lib/Numbers/standard_mathematical_functions.adb

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
with Ada.Numerics.Generic_Elementary_Functions;
with Ada.Numerics;

package body Standard_Mathematical_Functions is

  package Double_Elementary_Functions is
    new Ada.Numerics.Generic_Elementary_Functions (double_float);

-- ADDED FOR PATCH around bug in gcc version 3.2.2

 -- function C_COS ( x : double_float ) return double_float is

 --   function cos ( x : double_float ) return double_float;
 --   pragma interface(C,cos);

 -- begin
 --   return cos(x);
 -- end C_COS;

 -- function C_SIN ( x : double_float ) return double_float is

 --   function sin ( x : double_float ) return double_float;
 --   pragma interface(C,sin);

 -- begin
 --   return sin(x);
 -- end C_SIN;

-- END OF ADDITION FOR PATCH

  function EXP ( x : double_float ) return double_float is
  begin
    return Double_Elementary_Functions.exp(x);
  end EXP;

  function LN ( x : double_float ) return double_float is
  begin
    return Double_Elementary_Functions.log(x);
  end LN;

  function "**" ( x,y : double_float ) return double_float is
  begin
    return Double_Elementary_Functions."**"(x,y);
  end "**";

  function LOG2 ( x : double_float ) return double_float is
  begin
    return Double_Elementary_Functions.LOG(x,2.0);
  end LOG2;

  function LOG10 ( x : double_float ) return double_float is
  begin
    return Double_Elementary_Functions.LOG(x,10.0);
  end LOG10;

  function SQRT ( x : double_float ) return double_float is
  begin
    return Double_Elementary_Functions.SQRT(x);
  end SQRT;

  function SIN ( x : double_float ) return double_float is
  begin
    return Double_Elementary_Functions.SIN(x); -- PATCH for gcc 3.2.2
   -- return C_SIN(x);
  end SIN;

  function COS ( x : double_float ) return double_float is
  begin
    return Double_Elementary_Functions.COS(x); -- PATCH for gcc 3.2.2
   -- return C_COS(x);
  end COS;

  function TAN ( x : double_float ) return double_float is
  begin
    return Double_Elementary_Functions.TAN(x);
  end TAN;

  function ARCSIN ( x : double_float ) return double_float is
  begin
    return Double_Elementary_Functions.ARCSIN(x);
  end ARCSIN;

  function ARCCOS ( x : double_float ) return double_float is
  begin
    return Double_Elementary_Functions.ARCCOS(x);
  end ARCCOS;

  function ARCTAN ( x : double_float ) return double_float is
  begin
    return Double_Elementary_Functions.ARCTAN(x);
  end ARCTAN;

  function Radius ( x,y : double_float ) return double_float is
  begin
    return Sqrt(x**2+y**2);
  end Radius;

  function Angle ( x,y : double_float ) return double_float is
  begin
    return Double_Elementary_Functions.ARCTAN(y=>x,x=>y);
  end Angle;

end Standard_Mathematical_Functions;