-- -- demo\rosetta\FastFourierTransform.exw -- ===================================== -- -- Originally written by Robert Craig and posted to EuForum Dec 13, 2001 -- constant REAL = 1, IMAG = 2 type complex(sequence x) return length(x)=2 and atom(x[REAL]) and atom(x[IMAG]) end type function p2round(integer x) -- rounds x up to a power of two integer p = 1 while p0 then integer p = -1 while floor(x)=x do x /= 2 p += 1 end while if x=0.5 then return p end if end if return -1 end function function bitrev(sequence a) -- bitrev an array of complex numbers integer j=1, n = length(a) for i=1 to n-1 do if i