home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
326.lha
/
KFFT_v1.1
/
cmplx.doc.pp
/
cmplx.doc
Wrap
Text File
|
1990-01-06
|
2KB
|
51 lines
Cmplx.doc - Forth Complex Arithmetic Support Words for KFFT
Jerry Kallaus 02/14/89
The current version of the FFT code uses complex stack arithmetic
words which conditionally compile to perform either fixed point
or floating point (FFP) arithmetic.
Complex number definitions.
Each complex value occupies 2 cells for the real and imaginary parts.
Convention for complex number on stack is the imaginary part is on top.
Convention for complex number in memory is the real part is at lower addr.
In the following, z represents a complex vale, r a real value,
and n a fixed point value.
---------------- Complex Arithmetic Stack Words ---------------
Z+ ( z1 z2 -- z1+z2 ) add
Z- ( z1 z2 -- z1-z2 ) subtract
Z* ( z1 z2 -- z1*z2 ) multiply
ZNEGATE ( z -- -z ) negate
ZI* ( z -- z*i ) multiply z by sqrt(-1)
ZEXP ( r -- cosr sinr ) complex exponential
ZCONJG ( z -- conjugate z ) conjugate z
Z@ ( addr -- z ) fetch
Z! ( z addr -- ) store
ZCELL ( -- zcell ) complex cell size
ZCELL+ ( n -- n+zcell ) address increment
ZCELL- ( n -- n-zcell ) address decrement
ZCELLS ( n -- n*zcells ) multiply by complex cell size
ZDROP ( z -- ) complex drop
ZDUP ( z -- z z ) complex dup
ZOVER ( z1 z2 -- z1 z2 z1 ) complex over
Z2DUP ( z1 z2 -- z1 z1 z1 z2 ) complex 2 dup
----------------- Forth Complex Data Type Words -------------------
ZCONSTANT ( z -- ) ( name --input-- ) Create self fetching complex
constant.
ZVARIABLE ( name --input-- ) Create complex variable.
ZARRAY ( size -- ) ( name --input-- ) Create complex array.
Note: I half expect to find out that the intergalactic Forth
subcommittee on complex arithmetic has had a standard on file
which is contrary to everything here and I'm the last to know
about it!