From ce3f3c6221459ce1abeb39990f0f037d792251d0 Mon Sep 17 00:00:00 2001 From: Gerald Fournier <> Date: Mon, 16 Feb 2026 00:02:20 +0200 Subject: [PATCH] Fix FFT normalization --- src/frontend/com_fft.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/com_fft.c b/src/frontend/com_fft.c index 82ea72ca8..df73946a7 100644 --- a/src/frontend/com_fft.c +++ b/src/frontend/com_fft.c @@ -181,7 +181,7 @@ com_fft(wordlist *wl) fftw_execute(plan_forward); - scale = (double) fpts - 1.0; + scale = (double) (length*1.0/2.0); fdvec[i][0].cx_real = out[0][0]/scale/2.0; fdvec[i][0].cx_imag = 0.0; for (j = 1; j < fpts; j++) { @@ -215,7 +215,7 @@ com_fft(wordlist *wl) rffts(in, M, 1); fftFree(); - scale = (double) fpts - 1.0; + scale = (double) (length*1.0/2.0); /* Re(x[0]), Re(x[N/2]), Re(x[1]), Im(x[1]), Re(x[2]), Im(x[2]), ... Re(x[N/2-1]), Im(x[N/2-1]). */ fdvec[i][0].cx_real = in[0]/scale/2.0; fdvec[i][0].cx_imag = 0.0;