home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
xbase
/
library
/
dbase
/
compound
/
exponent.prg
< prev
next >
Wrap
Text File
|
1979-12-31
|
1KB
|
36 lines
* PROGRAM --- EXPONET.PRG
* CALCULATES THE EXPONET OF e FOR USE WITH DBASE II
* EXPECTS NUMBERIC VARIABLE, "NUMBER"
* RETURNS THE VARIABLE, "EXPONENT"
SET TALK OFF
STORE 1 TO POWER,FACTORIAL,INTERIM,EXPONENT,CHRCTRSTIC
* CALACULATION OF e RAISED TO THE CHARACTERISTIC OF THE EXPONENT
DO WHILE NUMBER >= 1
STORE CHRCTRSTIC * 2.7182818 TO CHRCTRSTIC
STORE NUMBER -1 TO NUMBER
ENDDO
* CALCULATION OF e RAISED TO THE MANTISSA OF THE EXPONENT
* (TAYLOR SERIES EXPANSION: E = 1+X+X /2! + X/3! +... + X/N!)
STORE INT(NUMBER * 100000) / 100000 + 1 TO NUMBER
STORE 35 TO COUNTER
DO WHILE POWER < COUNTER
STORE NUMBER * INTERIM TO INTERIM
STORE FACTORIAL * POWER TO FACTORIAL
STORE INTERIM / FACTORIAL + EXPONENT TO EXPONENT
STORE POWER + 1 TO POWER
ENDDO
* CONSTRUCT THE EXPOENT FROM ITS CHARACTERISTIC AND MANTISSA PARTS
STORE CHRCTRSTIC * EXPONENT / 2.7182818 TO EXPONENT
* ROUND OFF DECIMAL PORTION TO 5 PLACES
STORE INT(EXPONENT) + INT((EXPONENT-INT(EXPONENT))*100000+.5) / 100000.00000 ;
TO EXPONENT
RELEASE FACTORIAL,INTERIM,COUNTER,POSER,CHRCTRSIC
RETURN