home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 31 / CDASC_31_1996_juillet_aout.iso / vrac / cddk9605.zip / HEADERS.ARJ / MATH.INT < prev    next >
Text File  |  1996-05-17  |  5KB  |  137 lines

  1.  
  2. { ───────────────────────────────────────────────────────────────────────── }
  3. {  Name        : MATH.PAS                                                   }
  4. {  Description : Mathematics                                                }
  5. { ───────────────────────────────────────────────────────────────────────── }
  6.  
  7. UNIT Math;
  8.  
  9. {$B-} { . . . . . . . . . . . . . . . . . . . . Shortcut boolean evaluation }
  10. {$F+} { . . . . . . . . . . . . . . . . . . . .  Force far calls for safety }
  11. {$I-} { . . . . . . . . . . . . . . . . . . . Disable input/output checking }
  12. {$O+} { . . . . . . . . . . . . . . . . . . Allow this unit to be overlayed }
  13. {$Q-} { . . . . . . . . . . . . . .  Do not generate overflow-checking code }
  14. {$R-} { . . . . . . . . . . . . . . . . Do not generate range-checking code }
  15. {$S-} { . . . . . . . . . . . . . . . . Do not generate stack-checking code }
  16. {$X+} { . . . . . . . . . . . Extended syntax for pChars and function calls }
  17.  
  18. INTERFACE
  19.  
  20. TYPE
  21.  
  22.   { Turbo Pascal Real Types                                                 }
  23.   {                                                                         }
  24.   {   ┌────────────┬─────────────────────┬────────┬────┐                    }
  25.   {   │   Real     │ 2.9e-39..1.7e38     │ 11-12  │  6 │                    }
  26.   {   │ + Single   │ 1.5e-45..3.4e38     │  7-8   │  4 │                    }
  27.   {   │ + Double   │ 5.0e-324..1.7e308   │ 15-16  │  8 │                    }
  28.   {   │ + Extended │ 3.4e-4932..1.1e4932 │ 19-20  │ 10 │                    }
  29.   {   │ + Comp     │ -9.2e18..9.2e18     │ 19-20  │  8 │                    }
  30.   {   └────────────┴─────────────────────┴────────┴────┘                    }
  31.   {                                   + MathCo required                     }
  32.  
  33.   {$IFOPT N+}
  34.   Float = Extended;
  35.   {$ELSE}
  36.   Float = Real;
  37.   {$ENDIF}
  38.  
  39.   tComplex = OBJECT
  40.     a : Float;
  41.     b : Float;
  42.     PROCEDURE Add(CONST C:tComplex);
  43.     FUNCTION  Magnitude:Float;
  44.     PROCEDURE Multiply(CONST C:tComplex);
  45.     PROCEDURE Subtract(CONST C:tComplex);
  46.     END;
  47.  
  48.   pComplex = ^tComplex;
  49.  
  50.  
  51.   tFunction = FUNCTION (x:Float):Float;
  52.  
  53. { Angle Conversions }
  54.  
  55. FUNCTION Deg_Grd (CONST D:Float) : Float;  { Degrees  -> Gradians }
  56. FUNCTION Deg_Rad (CONST D:Float) : Float;  { Degrees  -> Radians  }
  57. FUNCTION Grd_Deg (CONST G:Float) : Float;  { Gradians -> Degrees  }
  58. FUNCTION Grd_Rad (CONST G:Float) : Float;  { Gradians -> Radians  }
  59. FUNCTION Rad_Deg (CONST R:Float) : Float;  { Radians  -> Degrees  }
  60. FUNCTION Rad_Grd (CONST R:Float) : Float;  { Radians  -> Gradians }
  61.  
  62. { Area Functions }
  63.  
  64. FUNCTION Area_Circle(CONST Radius:Float):Float;
  65. FUNCTION Area_Ellipse(CONST R1,R2:Float):Float;
  66. FUNCTION Area_Equilateral_Triangle(CONST S:Float):Float;
  67. FUNCTION Area_Rectangle(CONST X,Y:Float):Float;
  68. FUNCTION Area_Sector(CONST Radius, Angle:Float):Float;
  69. FUNCTION Area_Square(CONST Side:Float):Float;
  70. FUNCTION Area_Trapezoid(CONST A,B,H:Float):Float;
  71. FUNCTION Area_Triangle(CONST Base,Height:Float):Float;
  72.  
  73. { Calculus }
  74.  
  75. FUNCTION Simpson(CONST y:tFUNCTION; CONST a,b,n:LongInt):Float;
  76.  
  77. { Circumference Functions }
  78.  
  79. FUNCTION Circum_Circle(CONST R:Float):Float;
  80. FUNCTION Circum_Ellipse(CONST R1,R2:Float):Float;
  81.  
  82. { Hyperbolic Functions }
  83.  
  84. FUNCTION COSH(CONST R:Float):Float;  { Hyperbolic Cosine    }
  85. FUNCTION COTH(CONST R:Float):Float;  { Hyperbolic Cotangent }
  86. FUNCTION SECH(CONST R:Float):Float;  { Hyperbolic Secant    }
  87. FUNCTION SINH(CONST R:Float):Float;  { Hyperbolic Sine      }
  88. FUNCTION TANH(CONST R:Float):Float;  { Hyperbolic tangent   }
  89.  
  90. { Minimum/Maximum Functions }
  91.  
  92. FUNCTION MaxS(A,B:ShortInt) : ShortInt;
  93. FUNCTION MinS(A,B:ShortInt) : ShortInt;
  94. FUNCTION MaxB(A,B:Byte)     : Byte;
  95. FUNCTION MinB(A,B:Byte)     : Byte;
  96. FUNCTION MaxI(A,B:Integer)  : Integer;
  97. FUNCTION MinI(A,B:Integer)  : Integer;
  98. FUNCTION MaxW(A,B:Word)     : Word;
  99. FUNCTION MinW(A,B:Word)     : Word;
  100.  
  101. { Surface Area Functions }
  102.  
  103. FUNCTION Surface_Area_Box(CONST L,W,H:Float):Float;
  104. FUNCTION Surface_Area_Cone(CONST Radius,Height:Float):Float;
  105. FUNCTION Surface_Area_Cylinder(CONST Radius,Height:Float):Float;
  106. FUNCTION Surface_Area_Cube(CONST Side:Float):Float;
  107. FUNCTION Surface_Area_Sphere(CONST Radius:Float):Float;
  108.  
  109. { Trigonomic Functions }
  110.  
  111. FUNCTION COT(CONST R:Float):Float;   { Cotangent            }
  112. FUNCTION CSC(CONST R:Float):Float;   { Cosecant             }
  113. FUNCTION SEC(CONST R:Float):Float;   { Secant               }
  114. FUNCTION TAN(CONST R:Float):Float;   { Tangent              }
  115.  
  116. { Volume Functions }
  117.  
  118. FUNCTION Volume_Box(CONST X,Y,Z:Float):Float;
  119. FUNCTION Volume_Cone(CONST Radius,Height:Float):Float;
  120. FUNCTION Volume_Cube(CONST Side:Float):Float;
  121. FUNCTION Volume_Cylinder(CONST Radius,Height:Float):Float;
  122. FUNCTION Volume_Sphere(CONST Radius:Float):Float;
  123.  
  124. { Misc/Unsorted Functions }
  125.  
  126. FUNCTION Distance(X1,Y1,X2,Y2:Float):Float;
  127. FUNCTION Factorial(N:LongInt):LongInt;
  128. FUNCTION GCF(N1,N2:LongInt):LongInt;
  129. FUNCTION LCM(N1,N2:LongInt):LongInt;
  130. FUNCTION nCr(N,R:LongInt):LongInt;
  131. FUNCTION nPr(N,R:LongInt):LongInt;
  132. FUNCTION NLogX(N,X:Float):Float;
  133. FUNCTION Prime(N:LongInt):Boolean;
  134. FUNCTION Pythagoras(A,B:Float):Float;
  135. FUNCTION Within_Box(X,Y,X1,Y1,X2,Y2:LongInt):Boolean;
  136.  
  137.