mirror of
https://github.com/mborgerding/kissfft.git
synced 2025-11-27 04:52:45 -05:00
Allow setting a suffix for constants and trigonometric functions
In order to use constants or trigonometric functions with a type other than
double, a suffix ('f' for float or 'l' for long double) has to be used in C.
This commit adds a preprocessor macro 'kiss_fft_suffix' which can be set to
either 'f' or 'l' and which will be added to floating point constants and to
the trigonometric functions (sin and cos).
Without this suffix, the code will use a too high precision for float and a
too low precision for long double.
This commit is contained in:
@ -49,8 +49,8 @@ kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem,size_t * lenme
|
||||
kiss_fft_alloc(nfft, inverse_fft, st->substate, &subsize);
|
||||
|
||||
for (i = 0; i < nfft/2; ++i) {
|
||||
double phase =
|
||||
-3.14159265358979323846264338327 * ((double) (i+1) / nfft + .5);
|
||||
kiss_fft_scalar_one phase =
|
||||
KISS_ADD_SUFFIX(-3.14159265358979323846264338327) * ((kiss_fft_scalar_one) (i+1) / nfft + .5);
|
||||
if (inverse_fft)
|
||||
phase *= -1;
|
||||
kf_cexp (st->super_twiddles+i,phase);
|
||||
|
||||
Reference in New Issue
Block a user