Author Topic: Exponential Function  (Read 1236 times)

0 Members and 1 Guest are viewing this topic.

Offline zakath

  • Inactive Soldat Developer
  • Veteran
  • ******
  • Posts: 1224
    • Soldatladder
Exponential Function
« on: September 01, 2008, 04:59:06 pm »
Script Name: Exp
Script Description: Calculates the Exponential Function
Original Author(s): Zakath
Core Version: 2.6.3
Code:
Code: [Select]

const
EXPRECISION = 25; // the higher number the better precision and the more calculations(cputime)

function Exp(Exponent: double): double;
var
    i, j: integer;
    numerator, denominator: double;
begin
    Result := 1;


    for i:= 1 to EXPPRECISION do
    begin
        denominator := 1;
        numerator := 1;
        for j:= 1 to i do
        begin
            denominator := denominator * j;
            numerator := numerator * Exponent;
        end;
        Result := Result + numerator/denominator;
    end;
end;
« Last Edit: September 02, 2008, 02:51:02 am by zakath »

#soldat.mapping - #soldat.inc - #soldatladder - #soldat.gather.nordic