Use M_PI instead of M_PIl

M_PIl is the double precision constant for pi (3.14...).
This is not defined in all toolchains, resulting in the
following build error:

```
test/testcpp.cc:46:35: error: use of undeclared identifier 'M_PIl'; did you mean 'P_PID'?
     46 |         long double phinc = 2*k0* M_PIl / nfft;
        |                                   ^~~~~
        |                                   P_PID
```

The double precision constants may be a GNU extension. See:
https://www.gnu.org/software/libc/manual/html_node/Mathematical-Constants.html_node

Switching the test to use the single precision M_PI avoids this
error. The test still passes as the added precision of the
double is not required.

This fixes #87.
This commit is contained in:
Chris Mumford
2024-11-19 11:13:55 -05:00
parent f5f2a3b2f2
commit d12c0e1206

View File

@ -43,7 +43,7 @@ void dotest(int nfft)
long double difpower=0;
for (int k0=0;k0<nfft;++k0) {
complex<long double> acc = 0;
long double phinc = 2*k0* M_PIl / nfft;
long double phinc = 2*k0* M_PI / nfft;
for (int k1=0;k1<nfft;++k1) {
complex<long double> x(inbuf[k1].real(),inbuf[k1].imag());
acc += x * exp( complex<long double>(0,-k1*phinc) );