home *** CD-ROM | disk | FTP | other *** search
-
- { ******************************************* }
- { * * }
- { * The following is store as EXP.INC * }
- { * * }
- { ******************************************* }
-
-
- { Turbo Pascal with BCD option does not support the exp function. }
-
- { This used the taylor series expansion about x=0 to approximate exp(x). }
- { exp(x):=1 + x + ((x^2)/(2!)) + ((x^3)/(3!)) + }
- { ((x^4)/(4!)) + ... + ((x^n)/(n!)) + .. }
-
- { This expansion is valid for all real values of x. }
-
- function EXP(X:real):real;
- var WorkTotal:real;
- term :real;
- i :integer;
- begin;
- term:=x;
- WorkTotal:=1 + term;
- for i:=2 to 10 do
- begin;
- term:=term * x/i;
- WorkTotal:=WorkTotal + term;
- end;
- exp:=WorkTotal;
- end;
-
-