yandorazhang / GENESIS

GENetic Effect-Size distribution Inference from Summary-level data
14 stars 10 forks source link

changed PI to M_PI in EM_EM.cpp #5

Open ivvone opened 1 month ago

ivvone commented 1 month ago

When trying to download this package, I received an error (below) suggesting that PI was undefined, so I forked this repo and replaced PI with M_PI. After making this edit, I was able to download my forked repository.

Details: I assumed PI was supposed to represent the constant 3.1415... which seemed correct because this function returned the density of a normal distribution. I admit I don't know C++ at all, but I Googled it and found that pi is represented by the variable M_PI in C++. I'm not sure what might have changed in the past few years to have caused this error, but I wanted to point this out in case there was a better fix.

Thank you for your work in developing this method!

EM_EM.cpp: In function ‘long double cdnorm(long double, long double, long double, bool)’:
   EM_EM.cpp:96:23: error: ‘PI’ was not declared in this scope
      96 |   res = -0.5*log((2.0*PI))  - log(sd)- pow(x-mean, 2)/(2.0*pow(sd,2));
         |                       ^~
   make: *** [EM_EM.o] Error 1
   ERROR: compilation failed for package ‘GENESIS’