const
{$IFDEF PAIDVERS}
SDLVersionInfo = 'math1_r900_full';
IsLightEd = false;
{$ELSE}
SDLVersionInfo = 'math1_r900_lighted';
IsLightEd = true;
{$ENDIF}
Release = 900;
type
ESDLMath1Error = class(ESDLError); { exception type to indicate errors }
function AngleToXAxis
(x,y : double) { coordinates of data point }
: double; { angle between data point, origin and x-axis }
function Bin
(innum : longint; { number to convert to binary string }
places : byte) { number of places }
: string; { binary number }
function BitReversal
(InByte : byte) { input byte }
: byte; { bit-reversed byte }
function BRandom
(p : double) { probability }
: boolean; { TRUE with probability p }
procedure CalcScalePars
(Ntick : integer; { number of ticks on scale }
LowVal, { beginning of scaling }
HighVal : extended; { end point of scaling }
var LowTick, { first tick on scale }
Distance : extended; { distance of scale ticks }
var Divi : word); { nr. of divisions between scaling labels }
procedure CancelFraction
(var numer, { numerator of fraction }
denom : integer); { denominator of fraction }
function CanonicalAngleRadians
(phi : double) { angle in radians }
: double; { canonical angle in the range -Pi to +Pi }
function CanonicalAngleDegrees
(phi : double) { angle in degrees }
: double; { canonical angle in the range -180 to +180 }
procedure ConvertDegrees
(var deg, min, sec : double; { degrees, minutes, and seconds to convert }
InFormat, { input format }
OutFormat : TDegreeFormat); { output format }
function cosh
(x : double) { angle in radians }
: double; { hyperbolic cosine }
function cot
(x : double) { angle in radians }
: double; { cotangens }
function CountBits
(InByte : byte) { byte to count bits in }
: integer; { number of bits }
function Decimal
(innum : longint; { number to convert to decimal string }
places : byte) { number of places }
: string; { decimal string with leading 0s }
function DecodeBit
(ix : integer) { number of bit (0..7) }
: byte; { byte holding decoded bit }
function DecodeLong
(ix : integer) { number of bit (0..31) }
: longint; { longint holding decoded bit }
function DegreeToStr
(innum : double; { value to be converted }
format : TDegreeFormat; { format of output }
precision : integer) { number of decimal places }
: string; { deg/min/sec notation }
function EncodeLong
(value : longint) { longint holding decoded bit }
: integer; { number of bit (0..31) }
function EuclideanDistance
(x1,y1,x2,y2 : double) { coordinates of the two points }
: double; { Euclidean distance between the two points }
{$IFNDEF DOTNET}
procedure ExChange
(var x,y; { pair of variables, untyped }
size : word); overload; { length of variable }
{$ENDIF}
procedure ExChange
(var x,y : integer); overload; { variables to exchange }
procedure ExChange
(var x,y : byte); overload; { variables to exchange }
procedure ExChange
(var x,y : single); overload; { variables to exchange }
procedure ExChange
(var x,y : double); overload; { variables to exchange }
procedure ExChange
(var x,y : extended); overload; { variables to exchange }
procedure ExChange
(var x,y : string); overload; { variables to exchange }
procedure ExChange
(var x,y : char); overload; { variables to exchange }
procedure ExChange
(var x,y : boolean); overload; { variables to exchange }
{$IFDEF DOTNET}
procedure ExChange
(var x,y : AnsiChar); overload; { variables to exchange }
{$ENDIF}
procedure ExChange
(var x,y : ShortInt); overload; { variables to exchange }
procedure ExChange
(var x,y : Word); overload; { variables to exchange }
procedure ExChange
(var x,y : Cardinal); overload; { variables to exchange }
procedure ExChange
(var x,y : Int64); overload; { variables to exchange }
{$IFDEF GELEV7}
procedure ExChange
(var x,y : UInt64); overload; { variables to exchange }
{$ENDIF}
function Factorial
(argument : integer) { function argument }
: extended; { factorial of argument }
function GRandom
: double; { Gaussian noise }
function GrayCode
(InNum : word) { number to convert }
: word; { Gray code of 'InNum' }
function Hex
(innum : longint; { number to convert to hex string }
places : byte) { number of places }
: string; { hexadecimal notation }
{$IFNDEF DOTNET}
procedure InsertIntoArray
(ArrayAdr : pointer; { pointer to array }
LengArray : longint; { length of array }
TypArray : TVarKind; { type of field }
value : pointer; { value to put into array }
index : longint); overload; { index }
{$ENDIF}
function IntPos
(InNum : double) { number to process }
: longint; { next integer greater/equal to InNum }
function IntNeg
(InNum : double) { number to process }
: longint; { next integer smaller/equal to InNum }
function IsPrime
(number : integer) { number to test for prime }
: boolean; { returns TRUE if number is prime }
function IsValidBin
(Instring : string) { string to test for validity }
: boolean; { TRUE if string is valid binary number }
function IsValidDecInt
(Instring : string) { string to test for validity }
: boolean; { TRUE if string is valid decimal number }
function IsValidDouble
(InString : string; { string to test for validity }
AllowExp : boolean; { TRUE: allow exponential notation }
DecSeparator : TDecPSep) { decimal separator }
: boolean; { returns TRUE if string is valid f.p. number }
function IsValidFPNum
(Instring : string; { string to test for validity }
DecSeparator : TDecPSep) { decimal separator }
: boolean; { TRUE if string is valid float. point number }
function IsValidHex
(Instring : string) { string to test for validity }
: boolean; { TRUE if string is valid hex number }
function IsValidOct
(Instring : string) { string to test for validity }
: boolean; { TRUE if string is valid octal number }
function lg
(x : double) { argument }
: double; { common logarithm }
function ld
(x : double) { argument }
: double; { logarithmus dualis }
function LongRand
(seed : longint) { if not equal 0 then init }
: double; { random value [0.0,1.0] }
function MakeEFormat
(x : double; { number to convert }
w,d : integer) { width, decimal places }
: string; { string in FORTRAN format }
function Max
(a,b : double) { input variables }
: double; { maximum of a and b }
function Min
(a,b : double) { input variables }
: double; { minimum of a and b }
function Octal
(innum : longint; { nr. to convert to octal string }
places : byte) { number of places }
: string; { octal notation }
function Roman
(InNum : longint) { number to convert }
: string; { roman number }
function Round125
(InNum : double) { number to be rounded }
: double; { nearest number in the 1-2-5 system }
function RoundNeg125
(InNum : double) { number to be rounded }
: double; { number in the 125 system smaller/equal InNum }
function RoundPos125
(InNum : double) { number to be rounded }
: double; { number in the 125 system greater/equal InNum }
function ScanBin
(Instring : string; { string containing binary number }
var Idx : integer) { starting position of binary decoding }
: longint; { result }
function ScanDateTime
(InString, { string containing the date/time }
Format : string; { format of the date/time string }
Language : TLanguage; { language used }
var error : integer) { error flag }
: TDateTime; { result returns TDateTime of Instring }
function ScanDecimal
(Instring : string; { string containing decimal number }
var Idx : integer) { starting position of decimal decoding }
: longint; { result }
function ScanDegrees
(InString : string; { string containing the degrees }
var Idx : integer; { starting position of deg decoding }
ExpectGeo : boolean; { TRUE: geographic direction is expected }
var Error : integer) { error flag }
: double; { result returns degrees of Instring }
function ScanFPNum
(Instring : string; { string with floating point number }
AllowExp : boolean; { TRUE: allow exponential notation }
DecPChar : integer; { dec. point character }
var Idx : integer) { starting position of decimal decoding }
: double; { result }
function ScanHex
(Instring : string; { string containing hexadecimal number }
var Idx : integer) { starting position of hex decoding }
: longint; { result }
function ScanOctal
(Instring : string; { string containing octal number }
var Idx : integer) { starting position of octal decoding }
: longint; { result }
function Signum
(a : double) { input variable }
: integer; { signum(a) }
function sinh
(x : double) { angle in radians }
: double; { sinus hyperbolicus }
{$IFNDEF DOTNET}
procedure SortArray
(ArrayAdr : pointer; { pointer to array }
LengArray : longint; { length of array }
TypArray : TVarKind; { type of array }
Ascending : boolean); overload; { TRUE = ascending }
function SortIntoArray
(ArrayAdr : pointer; { pointer to array }
LengArray : longint; { length of array }
TypArray : TVarKind; { type of array }
value : pointer; { value to sort into }
Ascending : boolean; { TRUE = ascending }
Duplicates : boolean) { TRUE = duplicates allowed }
: longint; overload; { index of value }
{$ENDIF}
{$IFDEF LEVEL5} // Delphi 5 has bug with overloaded variable dynamic arrays
function SortIntoArrayInteger
(var SArray : array of integer;
value : integer;
Ascending : boolean;
Duplicates : boolean)
: longint;
function SortIntoArraySingle
(var SArray : array of single;
value : single;
Ascending : boolean;
Duplicates : boolean)
: longint;
function SortIntoArrayDouble
(var SArray : array of double;
value : double;
Ascending : boolean;
Duplicates : boolean)
: longint;
{$ELSE}
function SortIntoArray
(var SArray : array of integer;
value : integer;
Ascending : boolean;
Duplicates : boolean)
: longint; overload;
function SortIntoArray
(var SArray : array of single;
value : single;
Ascending : boolean;
Duplicates : boolean)
: longint; overload;
function SortIntoArray
(var SArray : array of double;
value : double;
Ascending : boolean;
Duplicates : boolean)
: longint; overload;
{$ENDIF}
{$IFDEF LEVEL5} // Delphi 5 has bug with overloaded variable dynamic arrays
procedure InsertIntoArraySingle
(var SArray : array of single;
value : single;
index : longint);
procedure InsertIntoArrayDouble
(var SArray : array of double;
value : double;
index : longint);
procedure InsertIntoArrayInteger
(var SArray : array of integer;
value : integer;
index : longint);
{$ELSE}
procedure InsertIntoArray
(var SArray : array of single;
value : single;
index : longint); overload;
procedure InsertIntoArray
(var SArray : array of double;
value : double;
index : longint); overload;
procedure InsertIntoArray
(var SArray : array of integer;
value : integer;
index : longint); overload;
{$ENDIF}
{$IFDEF LEVEL5} // Delphi 5 has bug with overloaded variable dynamic arrays
procedure SortArrayDouble
(var SArray : array of double; { array to be sorted }
Ascending : boolean); { TRUE = ascending }
procedure SortArraySingle
(var SArray : array of single; { array to be sorted }
Ascending : boolean); { TRUE = ascending }
procedure SortArrayInteger
(var SArray : array of integer; { array to be sorted }
Ascending : boolean); { TRUE = ascending }
{$ELSE}
procedure SortArray
(var SArray : array of double; { array to be sorted }
Ascending : boolean); overload; { TRUE = ascending }
procedure SortArray
(var SArray : array of single; { array to be sorted }
Ascending : boolean); overload; { TRUE = ascending }
procedure SortArray
(var SArray : array of integer; { array to be sorted }
Ascending : boolean); overload; { TRUE = ascending }
{$ENDIF}
function strf
(r : double; { number to convert }
FieldWidth : integer; { width of output field }
DecP : integer) { number of dec. places }
: string; { formatted string }
function StrToIntDefault
(InStr : string; { input string to be converted }
Def : integer) { default value if conversion fails }
: integer; { converted value }
function tg
(x : double) { angle in radians }
: double; { tangens }
function tgh
(x : double) { angle in radians }
: double; { tangens hyperbolicus }
function WithinBounds
(Inval : double; { value to compare }
Boundary1 : double; { boundary 1 of interval }
Boundary2 : double) { boundary 2 of interval }
: boolean; { TRUE if Inval within bounds }
|