#include #include #include // Each invocation of rnd returns a new random normal deviate. typedef double R; R sq(R x){return x*x;} R scale = 0x1.p-30; R rnd(){static int f = 0; static R m; if(f) {f = 0; return m;} while (1){R x = scale*random()-1, y = scale*random()-1, s = x*x +y*y; if(s<1) {R r = sqrt(- 2*log(s)/s); f = 1; m = x*r; return y*r;}}} typedef double _Complex C; typedef float _Complex c; C cmp(R x, R y){C z; __real__ z = x; __imag__ z = y; return z;} R m2(C p){return sq(__real__ p) + sq(__imag__ p);} void pc(c a){printf("%14.7e + %14.7ei\n", __real__ a, __imag__ a);} C it(C w){C r; __real__ r = - __imag__ w; __imag__ r = __real__ w; return r;} C Sqrt(C x){ R A = __real__ x, B = __imag__ x; if(A < 0) return it(Sqrt(-x)); {R r = sqrt((A + sqrt(A*A + B*B))/2); return r + it(B/(2*r));}} void fft(const int n, c a[n]){ {int j=0, i; for(i=0; i 11200000) {printf("j=%7d n=%e ", j, n); pc(d[j]);}}} return 0;}