ngspice calculates the normalization factor scale=N/2 using
int fpts = N/2+1
scale = (double) fpts - 1.0;
But of of course (double) ((int)N/2) does not equal ((double)N)/2 when N is odd. This error is very small unless N is also small.
HeAttached is a netlist testcase, and a porposed patch to fix it.
This only applies to odd FFT.
Commit b522bcc6c correct Nyquist bin scaling for Green branch dwarning
does not fix the bug.
I provided a tested patch - which you didn't use.
I provided a test for verifying the fix - which you didn't use to check your own fix.
Why?
You also labeled the fix as concerning the Green branch, when reality is that only FFTW has support for odd FFT.
Please revert b522bcc6c, and apply the patch I provided and tested.
I confirm that a31ac5420 fixed this issue.
dwarning, although I'm certainly glad you've started to use my patches, can you explain why you keep committing my patches and the fixes I identify under your own name rather than mine? it looks like you are taking credit for my work. Why?
No, I tried
git applyandgit ambut both failed for unknown reasons. Perhaps a crossing with my commits the patch was not synchronize.I will try to revert or editing the commit.
Please generate an new patch next time from pre-master-46.
I just resetted.
Thank you, I believe it was just an honest mistake.
Please be more careful about giving proper credit in the future. There's little reward in doing free open-source work except credit.
I see on other computer that my reset and push --force has not brought the result even it was shown as successful. May be we can change it by cherry pick from pre-master to master.
Normally the contributors work with own branches and make merge request's. That would be more safe and comfortable.
Last edit: Dietmar Warning 2026-03-05
No need to rewrite git history. Please be more careful in the future. I'll rebase future patches as needed.