mborgerding / kissfft

a Fast Fourier Transform (FFT) library that tries to Keep it Simple, Stupid
Other
1.39k stars 278 forks source link

Add global pi constant as define #23

Closed beecksche closed 5 years ago

beecksche commented 5 years ago

Instead of using local pi variables, a global constant is used.

mborgerding commented 5 years ago

Can you say more about what this change is trying to accomplish?

beecksche commented 5 years ago

First, to exclude the initialization of the variable from the for loop. What I think is more readable and also may improve the performance.

Secondly, for possible future features, where pi is necessary, only one definition is available.

mborgerding commented 5 years ago

I think any compiler will generate the same code before/after your change except maybe if all optimizations are turned off.
I see no real downside to it, other than the risk that comes with any code change. However since this seems to be merely a stylistic preference without substantial benefit, I am declining this PR.