home *** CD-ROM | disk | FTP | other *** search
/ TopWare Tools / TOOLS.iso / tools / top1164 / numeric.int < prev    next >
Encoding:
Text File  |  1994-02-15  |  6.4 KB  |  169 lines

  1. unit Numeric;
  2.  
  3. { Version 4.2
  4.   (c) 1993 by
  5.       Jochen Göttler
  6.       Im Dellbrunnen 6
  7.       D-66954 Pirmasens
  8.       Tel: 06331/92788
  9.       Fax: 06331/93620
  10. }
  11.  
  12. {$A+,B-,D-,F-,I-,L-,O-,R-,S-,V-,X-}
  13.  
  14.  
  15. interface
  16.  
  17.  
  18. const MaxWord                 = 65535;
  19.       MaxNumLength            = 17;
  20.       {  Maximale Länge einer Zahlenausgabe  }
  21.  
  22. {$IFOPT N-}
  23.  
  24.       epsilon: Real           = 1E-9;
  25.       Unendlich: Real         = 1E9;
  26.       MaxReal                 = 1.7E38;
  27.       MaxFacArg               = 33;
  28.       ExpLength               = 3;
  29.       {  Exponentenlänge  }
  30.       MaxRatDLength: Byte     = 11;
  31.       {  Maximale Dezimalstellenlänge, Standardformat  }
  32.  
  33. {$ELSE}
  34.  
  35.       epsilon: Extended       = 1E-13;
  36.       Unendlich: Extended     = 1E13;
  37.       MaxReal                 = 1.1E4932;
  38.       MaxFacArg               = 1754;
  39.       ExpLength               = 5;
  40.       MaxRatDLength: Byte     = 18;
  41.  
  42. type  Real                    = Extended;
  43.  
  44. {$ENDIF}
  45.  
  46. const Error:           Byte   = 0;
  47.       {  Liefert bei undef. math. Operation Wert 128  }
  48.       MaxExponDLength: Byte   = 10;
  49.       {  Maximale Dezimalstellenlänge, Exponentialformat  }
  50.       MinRatDLength           = 0;
  51.       MinExponDLength         = 1;
  52.       ExponFLength            = 4+ExpLength;
  53.  
  54. var   e, piDiv180, piHalbe:     Real;
  55.       {  Eulersche Konstante, pi/180, pi/2  }
  56.       MaxRat:                   Real;
  57.       {  Maximale nicht-exponentiell darstellbare Zahl  }
  58.       MaxExp, MinExp:           Integer;
  59.       {  Maximaler/Minimaler Exponent  }
  60.  
  61. function Minus    (x1, x2: Word):            Word;
  62.          {  Liefert x1-x2 für x1>x2, ansonsten 0  }
  63. function CTrunc   (x: Real):                 LongInt;
  64.          {  Absicherung gegen |x|>MaxLongInt -> Error:=128  }
  65. function CTruncI  (x: Real):                 Integer;
  66. function CRound   (x: Real):                 LongInt;
  67. function CRandom  (x: Real):                 LongInt;
  68. function Floor    (x: Real):                 LongInt;
  69.          {  Nächstkleinere ganze Zahl  }
  70. function Ceiling  (x: Real):                 LongInt;
  71.          {  Nächstgrößere ganze Zahl  }
  72. function Full     (x: Real):                 Real;
  73.          {
  74.          x<0:  Full(x):=Floor(x)
  75.          x>=0: Full(x):=Ceiling(x)
  76.          }
  77. function Exponent (r: Real):                 Integer;
  78. function Mantisse (r: Real):                 Real;
  79. function Decimals (r: Real; f: Boolean):     Word;
  80.          {
  81.          Liefert die Anzahl gültiger Nachkommastellen von r.
  82.          Für f=FALSE ist die Exponentialform von r Grundlage.
  83.          }
  84. function IsInteger (x: Real):                Boolean;
  85. function IsIntegerC(x: Real):                Boolean;
  86.          {  TRUE für x Ganzzahl und |x|<=MaxLongInt  }
  87. function NumStr   (r: Real):                 String;
  88. function NullStr  (n: LongInt; l: Byte):     String;
  89.          {  Konvertiert n in String der Länge l mit führenden Nullen  }
  90. function CDiv     (x1, x2: Real):            Real;
  91.          {  Absicherung gegen Division durch Null -> Error:=128  }
  92. function CIDiv    (x1, x2: LongInt):         LongInt;
  93.          {  Abgesicherte Integer-Division  }
  94. function CMod     (x1, x2: LongInt):         LongInt;
  95. function CSqrt    (x: Real):                 Real;
  96. function Power    (x1, x2: Real):            Real;
  97. function Exd      (e: Integer):              Real;
  98.          {  f(e)=10^e  }
  99. function Log      (b, x: Real):              Real;
  100. function Lg       (x: Real):                 Real;
  101.          {  Logarithmus zur Basis 10  }
  102. function Ld       (x: Real):                 Real;
  103.          {  Logarithmus zur Basis 2  }
  104. function CLn      (x: Real):                 Real;
  105. function Sgn      (x: Real):                 ShortInt;
  106. function Tan      (x: Real):                 Real;
  107. function Cot      (x: Real):                 Real;
  108. function Sec      (x: Real):                 Real;
  109. function Csc      (x: Real):                 Real;
  110. function ASin     (x: Real):                 Real;
  111. function ACos     (x: Real):                 Real;
  112. function ACot     (x: Real):                 Real;
  113. function ASec     (x: Real):                 Real;
  114. function ACsc     (x: Real):                 Real;
  115. function SinH     (x: Real):                 Real;
  116. function CosH     (x: Real):                 Real;
  117. function TanH     (x: Real):                 Real;
  118. function CotH     (x: Real):                 Real;
  119. function SecH     (x: Real):                 Real;
  120. function CscH     (x: Real):                 Real;
  121. function ASinH    (x: Real):                 Real;
  122. function ACosH    (x: Real):                 Real;
  123. function ATanH    (x: Real):                 Real;
  124. function ACotH    (x: Real):                 Real;
  125. function ASecH    (x: Real):                 Real;
  126. function ACscH    (x: Real):                 Real;
  127. function Fac      (x: Real):                 Real;
  128. function BinKoeff (x, y: Real):              Real;
  129. function Deg      (x: Real):                 Real;
  130. function Rad      (x: Real):                 Real;
  131. function DecConv  (d: LongInt; b: Byte):     String;
  132.          {
  133.          Umwandlung Dezimalsystem -> b-System
  134.          }
  135. function ConvDec  (s: String; b: Byte):      LongInt;
  136.          {
  137.          Umwandlung b-System -> Dezimalsystem
  138.          }
  139. function Conv     (s: String; b1, b2: Byte): String;
  140.          {
  141.          Umwandlung b1-System -> b2-System
  142.          }
  143. function  LoNibble      (x: Byte): Byte;
  144. function  HiNibble      (x: Byte): Byte;
  145. procedure SwapByte      (var x, y: Byte);
  146. procedure SwapWord      (var x, y: Word);
  147. procedure SwapShortInt  (var x, y: ShortInt);
  148. procedure SwapInteger   (var x, y: Integer);
  149. procedure SwapLongInt   (var x, y: LongInt);
  150. procedure SwapReal      (var x, y: Real);
  151. procedure SwapBoolean   (var x, y: Boolean);
  152. procedure IncReal       (var x: Real; y: Real);
  153. procedure DecReal       (var x: Real; y: Real);
  154. function  MaxOfByte     (x, y: Byte): Byte;
  155. function  MaxOfWord     (x, y: Word): Word;
  156. function  MaxOfShortInt (x, y: ShortInt): ShortInt;
  157. function  MaxOfInteger  (x, y: Integer): Integer;
  158. function  MaxOfLongInt  (x, y: LongInt): LongInt;
  159. function  MaxOfReal     (x, y: Real): Real;
  160. function  MinOfByte     (x, y: Byte): Byte;
  161. function  MinOfWord     (x, y: Word): Word;
  162. function  MinOfShortInt (x, y: ShortInt): ShortInt;
  163. function  MinOfInteger  (x, y: Integer): Integer;
  164. function  MinOfLongInt  (x, y: LongInt): LongInt;
  165. function  MinOfReal     (x, y: Real): Real;
  166.  
  167.  
  168. end.
  169.