ANN: advanced math library ported from Turbo Pascal 
Author Message
 ANN: advanced math library ported from Turbo Pascal

ANNOUNCEMENT:
I have ported an advanced Turbo Pascal Math Library to Oberon (-1), based on
J.Debord's TP package.
To honor this fact, its named JDMathL.
Its still beta.

More stuff of the package might follow under the JD* designation.
(Collaborators for porting welcome. What would also be extremely helpful are
people who know how to use the SIMD features of the new processors for a low
level,
machine specific module, e.g. for the upcoming FFT, DSP modules etc).

Here the contents of MODULE JDMathL.Mod:
 ------- Error handling function-------------
PROCEDURE MathError : LONGINT;  (* Error code from the last function call *)

 ------- Minimum, maximum, sign and exchange---------------
PROCEDURE FMin(X, Y : Float) : Float;      (* Minimum of 2 reals *)
PROCEDURE FMax(X, Y : Float) : Float;      (* Maximum of 2 reals *)
PROCEDURE IMin(X, Y : LONGINT) : LONGINT;  (* Minimum of 2 integers *)
PROCEDURE IMax(X, Y : LONGINT) : LONGINT;  (* Maximum of 2 integers *)
PROCEDURE Sgn(X : Float) : LONGINT;        (* Sign (returns 1 IF X = 0) *)
PROCEDURE Sgn0(X : Float) : LONGINT;       (* Sign (returns 0 IF X = 0) *)
PROCEDURE FSwap(VAR X, Y : Float);        (* Exchange 2 reals *)
PROCEDURE ISwap(VAR X, Y : LONGINT);      (* Exchange 2 integers *)

 ------ Assembler PROCEDUREs  ---------------
 (None in this version)
 --------- Sign, logarithms, exponentials and power---------------
PROCEDURE Expo(X : Float) : Float;                   (* Exponential *)
PROCEDURE Exp2(X : Float) : Float;                   (* 2^X *)
PROCEDURE Exp10(X : Float) : Float;                  (* 10^X *)
PROCEDURE Log(X : Float) : Float;                    (* Natural log *)
PROCEDURE Log2(X : Float) : Float;                   (* Log, base 2 *)
PROCEDURE Log10(X : Float) : Float;                  (* Decimal log *)
PROCEDURE LogA(X, A : Float) : Float;                (* Log, base A *)
PROCEDURE IntPower(X : Float; N : LONGINT) : Float;  (* X^N *)
PROCEDURE Power(X, Y : Float) : Float;               (* X^Y, X >= 0 *)
PROCEDURE Pythag(X, Y : Float) : Float;              (* Sqrt(X^2 + Y^2) *)
 ------- Trigonometric and inverse trigonometric PROCEDUREs --------------
PROCEDURE FixAngle(Theta : Float) : Float;  (* Set Theta in -Pi..Pi *)
PROCEDURE Tan(X : Float) : Float;           (* Tangent *)
PROCEDURE ArcSin(X : Float) : Float;        (* Arc sinus *)
PROCEDURE ArcCos(X : Float) : Float;        (* Arc cosinus *)
PROCEDURE ArcTan2(Y, X : Float) : Float;    (* Angle (Ox, OM) with M(X,Y) *)

PROCEDURE SinCos(X : Float; var SinX, CosX : Float);  (* Sin & Cos *)
----------------- Hyperbolic and inverse hyperbolic PROCEDUREs----------
PROCEDURE Sinh(X : Float) : Float;     (* Hyperbolic sine *)
PROCEDURE Cosh(X : Float) : Float;     (* Hyperbolic cosine *)
PROCEDURE Tanh(X : Float) : Float;     (* Hyperbolic tangent *)
PROCEDURE ArcSinh(X : Float) : Float;  (* Inverse hyperbolic sine *)
PROCEDURE ArcCosh(X : Float) : Float;  (* Inverse hyperbolic cosine *)
PROCEDURE ArcTanh(X : Float) : Float;  (* Inverse hyperbolic tangent *)

PROCEDURE SinhCosh(X : Float; var SinhX, CoshX : Float);  (* Sinh & Cosh *)
---------- Special PROCEDUREs ------------------------
PROCEDURE Fact(N : LONGINT) : Float;         (* Factorial *)
PROCEDURE Binomial(N, K : LONGINT) : Float;  (* Binomial coef. C(N,K) *)
PROCEDURE Gamma(X : Float) : Float;          (* Gamma PROCEDURE *)
PROCEDURE SgnGamma(X : Float) : LONGINT;     (* Sign of Gamma PROCEDURE *)
PROCEDURE LnGamma(X : Float) : Float;        (* Log(|Gamma(X)|) *)
PROCEDURE IGamma(A, X : Float) : Float;      (* Incomplete Gamma PROCEDURE
*)
PROCEDURE JGamma(A, X : Float) : Float;      (* Complement of IGamma *)
PROCEDURE Beta(X, Y : Float) : Float;        (* Beta PROCEDURE *)
PROCEDURE IBeta(A, B, X : Float) : Float;    (* Incomplete Beta PROCEDURE *)
PROCEDURE Erf(X : Float) : Float;            (* Error PROCEDURE *)
PROCEDURE Erfc(X : Float) : Float;           (* Complement of Erf *)
-------- Binomial distribution with probability P and number of repetitions
N----
PROCEDURE PBinom(N : LONGINT; P : Float; K : LONGINT) : Float; (* Prob(X =
K) *)
PROCEDURE FBinom(N : LONGINT; P : Float; K : LONGINT) : Float; (* Prob(X <=
K) *)

--------------------- Poisson distribution with mean Mu-----------
PROCEDURE PPoisson(Mu : Float; K : LONGINT) : Float;  (* Prob(X = K) *)
PROCEDURE FPoisson(Mu : Float; K : LONGINT) : Float;  (* Prob(X <= K) *)
---------------- Standard normal distribution--------------------
PROCEDURE DNorm(X : Float) : Float;    (* Density of standard normal *)
PROCEDURE FNorm(X : Float) : Float;    (* Prob(U <= X) *)
PROCEDURE PNorm(X : Float) : Float;    (* Prob(|U| >= |X|) *)
PROCEDURE InvNorm(P : Float) : Float;  (* Inverse of FNorm : returns X
                                        such that Prob(U <= X) = P*)

-----------------  Student distribution with Nu d.o.f.-------------
PROCEDURE DStudent(Nu : LONGINT; X : Float) : Float;  (* Density of t *)
PROCEDURE FStudent(Nu : LONGINT; X : Float) : Float;  (* Prob(t <= X) *)
PROCEDURE PStudent(Nu : LONGINT; X : Float) : Float;  (* Prob(|t| >= |X|) *)
---------------- Khi-2 distribution with Nu d.o.f.----------------
PROCEDURE DKhi2(Nu : LONGINT; X : Float) : Float;  (* Density of Khi2 *)
PROCEDURE FKhi2(Nu : LONGINT; X : Float) : Float;  (* Prob(Khi2 <= X) *)
PROCEDURE PKhi2(Nu : LONGINT; X : Float) : Float;  (* Prob(Khi2 >= X) *)

----------- Fisher-Snedecor distribution with Nu1 and Nu2 d.o.f.-------
PROCEDURE DSnedecor(Nu1, Nu2 : LONGINT; X : Float) : Float;  (* Density of F
*)
PROCEDURE FSnedecor(Nu1, Nu2 : LONGINT; X : Float) : Float;  (* Prob(F <= X)
*)
PROCEDURE PSnedecor(Nu1, Nu2 : LONGINT; X : Float) : Float;  (* Prob(F >= X)
*)
------------- Exponential distribution------------------
PROCEDURE DExpo(A, X : Float) : Float;  (* Density of exponential distrib.
*)
PROCEDURE FExpo(A, X : Float) : Float;  (* Prob( <= X) *)

------------- Beta distribution-----------------
PROCEDURE DBeta(A, B, X : Float) : Float;   (* Density of Beta distribution
*)
PROCEDURE FBeta(A, B, X : Float) : Float;   (* Prob( <= X) *)

-------------  Gamma distribution-----------
PROCEDURE DGamma(A, B, X : Float) : Float;  (* Density of Gamma distribution
*)
PROCEDURE FGamma(A, B, X : Float) : Float;  (* Prob( <= X) *)

It should be available soon on the contrib section of the
http://www.*-*-*.com/ page.

Pat



Tue, 18 Mar 2003 03:00:00 GMT  
 ANN: advanced math library ported from Turbo Pascal
It can be found at

ftp://ftp.inf.ethz.ch/pub/ETHOberon/Contrib/JD/



Tue, 18 Mar 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Interfacing Turbo Prolog to Turbo Pascal of Turbo C

2. link ASM files (TASM) to Turbo Pascal (I know Pascal sux)

3. ANN: pySerial - a mulitplatform serial port library (Win32, Linux, Jython)

4. ANN: USPP (Universal Serial Port Python) Library version 0.1

5. ANN: pyserial - a mulitplatform serial port library (Win32, Linux, Jython)

6. standard library and 3D math library?

7. 6 byte Turbo Pascal Reals - any experts

8. Converting Turbo Pascal Files to TPS/Clarion Files

9. Eiffel vs Turbo Pascal 5.5

10. The student of Turbo Pascal

11. Wanted: SIMULA to Turbo pascal source converter.

12. Turbo Pascal 1.0 trivia

 

 
Powered by phpBB® Forum Software