From 4983e9220cfe784eae86111a93fb9dd164a374d0 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Mon, 26 Jul 2010 15:04:56 +0200 Subject: [PATCH] Add more math functions. --- Units/MMLAddon/PSInc/Wrappers/math.inc | 105 +++++++++++++++++++++ Units/MMLAddon/PSInc/psexportedmethods.inc | 22 +++++ 2 files changed, 127 insertions(+) diff --git a/Units/MMLAddon/PSInc/Wrappers/math.inc b/Units/MMLAddon/PSInc/Wrappers/math.inc index 7de9700..f2e4385 100644 --- a/Units/MMLAddon/PSInc/Wrappers/math.inc +++ b/Units/MMLAddon/PSInc/Wrappers/math.inc @@ -191,3 +191,108 @@ function ps_rol(num : longword; shift : byte) : LongWord; extdecl; begin result := RolDWord(num,shift); end; + +function ps_tan(e: extended): extended; +begin + result:= tan(e); +end; + +function ps_radians(e: extended): extended; +begin + result := e / 180.0 * pi; +end; + +function ps_degrees(e: extended): extended; +begin + result := e * 180.0 / pi; +end; + +function ps_ArcSin(e: extended): extended; +begin + result := ArcSin(e); +end; + +function ps_ArcCos(e: extended): extended; +begin + result := ArcCos(e); +end; + +function ps_ArcTan(e: extended): extended; +begin + result := ArcTan(e); +end; + +function ps_Cotan(e: extended): extended; +begin + result := Cotan(e); +end; + +function ps_Secant(e: extended): extended; +begin + result := Secant(e); +end; + +function ps_Cosecant(e: extended): extended; +begin + result := Cosecant(e); +end; + +function ps_Cot(e: extended): extended; +begin + result := Cot(e); +end; + +function ps_Sec(e: extended): extended; +begin + result := Sec(e); +end; + +function ps_Csc(e: extended): extended; +begin + result := Csc(e); +end; + +function ps_Cosh(e: extended): extended; +begin + result := Cosh(e); +end; + +function ps_Sinh(e: extended): extended; +begin + result := Sinh(e); +end; + +function ps_Tanh(e: extended): extended; +begin + result := tanh(e); +end; + +function ps_CotH(e: extended): extended; +begin + result := cotan(e); +end; + +function ps_SecH(e: extended): extended; +begin + result := secant(e); +end; + +function ps_CscH(e: extended): extended; +begin + result := Csc(e); +end; + +function ps_ArcCosh(e: extended): extended; +begin + result := ArcCosh(e); +end; + +function ps_ArcSinh(e: extended): extended; +begin + result := ArcSinh(e); +end; + +function DecRet(e: Extended): Extended; +begin + result := e - Trunc(e); +end; diff --git a/Units/MMLAddon/PSInc/psexportedmethods.inc b/Units/MMLAddon/PSInc/psexportedmethods.inc index faa15f6..8762662 100644 --- a/Units/MMLAddon/PSInc/psexportedmethods.inc +++ b/Units/MMLAddon/PSInc/psexportedmethods.inc @@ -83,6 +83,28 @@ AddFunction(@ps_hextoint,'function HexToInt(Hex : string) : integer'); AddFunction(@ps_sar,'function sar(AValue : longint; shift : byte) : longint;'); AddFunction(@ps_ror,'function ror(num : longword; shift : byte) : LongWord;'); AddFunction(@ps_rol,'function rol(num : longword; shift : byte) : LongWord;'); +AddFunction(@ps_tan, 'function ps_tan(e: extended): extended;'); +AddFunction(@ps_radians, 'function radians(e: extended): extended;'); +AddFunction(@ps_degrees, 'function degrees(e: extended): extended;'); +AddFunction(@ps_ArcSin, 'function ArcSin(e: extended): extended;'); +AddFunction(@ps_ArcCos, 'function ArcCos(e: extended): extended;'); +AddFunction(@ps_ArcTan, 'function ArcTan(e: extended): extended;'); +AddFunction(@ps_Cotan, 'function Cotan(e: extended): extended;'); +AddFunction(@ps_Secant, 'function Secant(e: extended): extended;'); +AddFunction(@ps_Cosecant, 'function Cosecant(e: extended): extended;'); +AddFunction(@ps_Hypot, 'function Hypot(e: extended): extended;'); +AddFunction(@ps_Cot, 'function Cot(e: extended): extended;'); +AddFunction(@ps_Sec, 'function Sec(e: extended): extended;'); +AddFunction(@ps_Csc, 'function Csc(e: extended): extended;'); +AddFunction(@ps_Cosh, 'function Cosh(e: extended): extended;'); +AddFunction(@ps_Sinh, 'function Sinh(e: extended): extended;'); +AddFunction(@ps_Tanh, 'function Tanh(e: extended): extended;'); +AddFunction(@ps_CotH, 'function CotH(e: extended): extended;'); +AddFunction(@ps_SecH, 'function SecH(e: extended): extended;'); +AddFunction(@ps_CscH, 'function CscH(e: extended): extended;'); +AddFunction(@ps_ArcCosh, 'function ArcCosh(e: extended): extended;'); +AddFunction(@ps_ArcSinh, 'function ArcSinh(e: extended): extended;'); +AddFunction(@DecRet, 'function DecRet(e: Extended): Extended;'); {$IFNDEF MML_EXPORT_THREADSAFE} {window}