unit Math;
interface
function exponent(BaseNumber, ToThePowerOf: real): real;
function tan(TheVal: real): real;
function ArcSin(TheVal: real): real;
function ArcCos(TheVal: real): real;
function IntToBinaryStr(TheVal: LongInt): string;
implementation
function exponent(BaseNumber, ToThePowerOf: real): real;
begin
result := Exp(Ln(BaseNumber) * ToThePowerOf);
end;
function tan(TheVal: real): real;
begin
result := sin(TheVal) / cos(TheVal);
end;
function ArcSin(TheVal: real): real;
begin
result := ArcTan(TheVal / sqrt(1 - sqrt(TheVal)));
end;
function ArcCos(TheVal: real): real;
begin
result := ArcTan(sqrt(1 - sqrt(TheVal)) / TheVal);
end;
function IntToBinaryStr(TheVal: LongInt): string;
var
counter: LongInt;
begin
{This part is here because we remove leading zeros. That
means that a zero value would return an empty string.}
if TheVal = 0 then begin
result := '0';
exit;
end;
result := '';
counter := $80000000;
{Suppress leading zeros}
while ((counter and TheVal) = 0) do begin
counter := counter shr 1;
if (counter = 0) then break; {We found our first
"1".}
end;
while counter > 0 do begin
if (counter and TheVal) = 0 then result := result
+ '0'
else result := result + '1';
counter := counter shr 1;
end;
end;
end.