ReadySteadyGo
2010-07-24 19:50:03
Please add.
2010-07-24 19:50:03
2010-07-24 21:18:17
2010-07-24 21:28:55
function Tan(e: Extended): Extended;
begin
Result := sin(e) / cos(e);
end;
function Radians(e: Extended): Extended;
begin
Result := e * 180 / Pi;
end;
2010-07-24 22:15:32
2010-07-25 03:40:09
2010-07-25 11:00:25
2010-07-25 12:44:03
function ArcTan(X: Extended): Extended;
The ArcTan function is a mathematical function giving the value in radians of the Arc Tangent of X.
function ArcSin(X: Extended): Extended;
The ArcSin function is a mathematical function giving the value in radians of the Arc Sine of X.
function ArcCos(X: Extended): Extended;
The ArcCos function is a mathematical function giving the value in radians of the Arc Cosine of X.
function Cotan(X: Extended): Extended;
1 / tan(X), X <> 0
function Secant(X: Extended): Extended;
1 / cos(X)
function Cosecant(X: Extended): Extended;
1 / sin(X)
function Hypot(X, Y: Extended): Extended;
Sqrt(X**2 + Y**2)
function Cot(X: Extended): Extended;
Alias for Cotan.
function Sec(X: Extended): Extended;
Alias for Secant.
function Csc(X: Extended): Extended;
Alias for Cosecant.
function Cosh(X: Extended): Extended;
Hyperbolic cosine.
function Sinh(X: Extended): Extended;
Hyperbolic sine.
function Tanh(X: Extended): Extended;
Hyperbolic tangent.
function CotH(X: Extended): Extended;
Hyperbolic cotangent.
function SecH(X: Extended): Extended;
Hyperbolic secant.
function CscH(X: Extended): Extended;
Hyperbolic cosecant.
function ArcCot(X: Extended): Extended;
Inversed cotangent.
function ArcSec(X: Extended): Extended;
Inversed secant.
function ArcCsc(X: Extended): Extended;
Inversed cosecant.
function ArcCosh(X: Extended): Extended;
Inversed hyperbolic cosine.
function ArcSinh(X: Extended): Extended;
Inversed hyperbolic sine.
function ArcTanh(X: Extended): Extended;
Inversed hyperbolic tangent.
function ArcCotH(X: Extended): Extended;
Inversed hyperbolic cotangent.
function ArcSecH(X: Extended): Extended;
Inversed hyperbolic secant.
function ArcCscH(X: Extended): Extended;
Inversed hyperbolic cosecant.
function LnXP1(X: Extended): Extended;
Return ln(1 + X). Accurate for X near 0.
function Log10(X: Extended): Extended;
The Log10 function returns the logarithm to base 10 of X.
function Log2(X: Extended): Extended;
function LogN(Base, X: Extended): Extended;
function Exp(Number: Extended): Extended;
The Exp function takes an integer or floating point Number and raises e (2.72) to that power.
function Factorial(number: Int64): Int64;
Returns the factorial (!) of number.
function BinCoe(a, b: LongInt): Extended;
Returns the binomial coefficient of a and b (a over b).
function Degrees(Radians: Extended): Extended;
Returns radians in 0-360 degree form.
function Radians(Degrees: Extended): Extended;
Returns the degrees in 0 to 2Pi radian form.
function Inversus(E: Extended): Extended;
Returns the E, inversed.
function DecRet(E: Extended): Extended;
Returns the decimal part of E.
Example:
DecRet(28.4678) = 0.4678
function InCircle(x, y, mx, my, r: Integer): Boolean;
Returns true if x and y are in or on a circle specified by the midpoints mx, my and the radius r.
function InTriangle(x, y, x1, y1, x2, y2, x3, y3: Integer): Boolean;
Returns true if the coordinate x, y is in the truangle defined by the coordinates: (x1, y1) (x2, y2) (x3, y3).
function AdjustD(Angle, Adjustment: Extended): Extended;
Adds Adjustment to Angle and returns the angle in 0-360 form.
function FixR(Radians: Extended): Extended;
Returns Radians in 0 to 2Pi form.
function AdjustR(Angle, Adjustment: Extended): Extended;
Adds Adjustment to Angle and returns in 0 to 2Pi form.
function AMin(Data: TIntegerArray): Integer;
Returns the smallest integer value of all values in Data.
function AMinE(Data: TExtendedArray): Extended;
Returns the smallest extended value of all values in Data.
function AMax(Data: TIntegerArray): Integer;
Returns biggest integer value of all values in Data.
function AMaxE(Data: TExtendedArray): Extended;
Returns biggest extended value of all values in Data.
function iAbs(Number: Integer): Integer;
Returns absolute value of an integer (converts negative number to positive).
function ToCart(Point: PPoint): TPoint;
Returns the Cartesian Point of Polar Point point relative to the origin.
function ToCartOffset(Point: PPoint; offset: TPoint): TPoint;
Returns the Cartesian Point of Polar Point point, relative to the offset.
Note: The Polar Point is relative to offset, the Cartesian Point is Relative to the origin.
function ToPolar(Point: TPoint): PPoint;
Returns the Polar Point, relative to the origin, of Cartesian Point point.
function ToPolarOffset(Point, offset: TPoint): PPoint;
Returns the Polar Point, relative to the offset, of Cartesian Point point.
Note: The Polar Point is relative to the offset, the point and offset are Relative to the origin.
Note2: To turn the result back to cartesian use: ToCartOffset(result, offset).
function Average(Values: TExtendedArray): Extended;
Returns the average of the entered Values.
procedure BubbleSort(var Values: TIntegerArray);
Sorts the values in the entered array from small to large using the BubbleSort algorithm.
procedure BubbleSortB(var Values: TIntegerArray);
Sorts the values in the entered array from large to small using the BubbleSort algorithm.
function Average(Values: TExtendedArray): Extended;
Returns the average of the entered Values.
function Left(Text: string; Count: Integer): string;
Returns a part of the leftside of a string, the length is specified by Count.
function Right(Text: string; Count: Integer): string;
Returns a part of the rightside of a string, the length is specified by Count.
function TrimNumbers(Text: string): string;
Removes all numerical chars from a string.
function TrimLetters(Text: string): string;
Removes all alphabetical chars from a string.
function TrimOthers(Text: string): string;
Removes all chars that are not numerical and not alphabetical from a string.
function PosEx(search, s: string; from: Integer): Integer;
Returns the position of the substring in s searching forwards from from.
function LastPosEx(search, s: string; from: Integer): Integer;
Returns the position of the substring in s searching backwards from from.
function LastPos(search, s: string): Integer;
Returns the position of the substring in s searching backwards from the end of the string.
function StartsWith(prefix, s: string): Boolean;
Returns true if s starts with prefix.
function EndsWith(suffix, s: string): Boolean;
Returns true if s ends with suffix.
function TrimEx(delimiter, s: string): string;
Trims the specified delimiter from the start and end of the string.
function RegexPos(Txt, Regex: string): Integer;
Returns the position of the first found occurence of the regex.
function FindRegex(Txt, Regex: string): string;
Returns the string found by the regex.
function ReplaceRegex(Txt, Regex, ReplaceStr: string): string;
Replaces all occurences of the found regex by ReplaceStr.
function MD5(s: string): string;
Converts a string to an MD5 hash.
function ExplodeEx(Separator, s: string; Limit: Integer): TStringArray;
Explodes a string into pieces with a Limit. function DecRet(E: Extended): Extended;
begin
Result := E - Trunc(E);
end;function EndsWith(Suffix, S: string): Boolean;
begin
Result := Pos(Suffix, S) = (Length(S) - Length(Suffix) + 1);
end;
2010-07-25 14:03:28
function AMaxE(Data: TExtendedArray): Extended;
Returns biggest extended value of all values in Data.
function iAbs(Number: Integer): Integer;
Returns absolute value of an integer (converts negative number to positive).
procedure BubbleSort(var Values: TIntegerArray);
Sorts the values in the entered array from small to large using the BubbleSort algorithm.
procedure BubbleSortB(var Values: TIntegerArray);
Sorts the values in the entered array from large to small using the BubbleSort algorithm.
function Average(Values: TExtendedArray): Extended;
Returns the average of the entered Values.2010-07-25 14:17:09
2010-07-25 18:19:15
2010-07-25 18:46:27
From: Nava2
I don't see why you would need a lot of those math functions. Most of them are derived from other math functions.
Tan is an exception because I'm sure there are some parts which are improved when using the sin() and cos() algorithm together.
2010-07-25 19:37:34
2010-07-26 00:02:47
From: Wizzup?
Doing some math wrappers now. (Not doing all, as I found some not to be in FPC atm, but they didn't seem important)
Anyway, writing wrappers made easy: http://wizzup.org/static/vim.ogg
2010-07-26 00:40:57
2010-07-26 01:50:28
From: SubiN
how is trignometric functions useful in simba ? Give me something practical
2010-07-26 02:05:01
2010-07-31 15:23:47
2010-07-31 19:53:32
From: Wizzup?
Commited most of the math functions plus PosEx. (They are in Unstable, see sig)
Any particular string functions that are required?
2010-08-01 00:44:55
2010-08-01 18:55:11