-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting a suffix for constants and trigonometric functions #14
base: master
Are you sure you want to change the base?
Conversation
Thanks for the input. I think this will improve accuracy for |
Comparing strings in the C preprocessor is rather difficult, especially because
|
@steffen-kiess Could you put the above preprocessor hack into a PR? |
a10e9c4
to
63a6f80
Compare
I've updated this pull request. |
63a6f80
to
0b33f15
Compare
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.
0b33f15
to
5ebbc5e
Compare
The change was breaking |
Thanks for the update. Your preprocessor kung fu is strong. At times like this, I would reach for templates in a c++ project. I'll take a closer look and expect to merge this soon. |
This is similar to #12, but for the C version. The C version uses sin() and cos() and constants (for pi) which are not accurate enough for long double.
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.