kissfft icon indicating copy to clipboard operation
kissfft copied to clipboard

"kiss_fft_scalar" definition not been replaced if build with double type

Open kemen209 opened this issue 3 years ago • 1 comments

I use cmake to build kissfft as staticlib on macOS 11 with property -DKISSFFT_DATATYPE=double, every thing works fine until i try to use it my project.

I got nan values from kiss_fft(), and my input array also been changed!!!

After i done some debugging and search on Web, i found that the definition of kiss_fft_scalar in file kiss_fft.h:

# ifndef kiss_fft_scalar
/*  default is float */
#   define kiss_fft_scalar float
# endif

It still set to float, which cause the kissfft fail to calculate the pos of data, lead to access someone else's memory. After i change the float to double, everything works like charm!

I dont' know if i made some mistake during the build process, or there is something you guys missed here.

My build step:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DKISSFFT_DATATYPE=double -DKISSFFT_STATIC=ON -DKISSFFT_TEST=OFF -DKISSFFT_TOOLS=OFF ..
make

kemen209 avatar Mar 21 '21 05:03 kemen209

Hello,

I see that this post is one year old, but I am still having the same issue. There is a problem with the default type of kiss_fft_scalar when using kissfft for double input. If one sets the default value to double as @kemen209 then one gets the correct result. Seems like a bug to me.

Panadestein avatar Sep 26 '22 09:09 Panadestein