First off, grep for pi
in /usr/share/R/include/
and you find eg
#define M_PI 3.141592653589793238462643383280 /* pi */
so that you have where R is used, eg here with Rcpp and RcppEigen.
Example:
R> getpi <- cppFunction('double twopi() { return M_PI; } ')
R> getpi()
[1] 3.142
R> print(getpi(), digits=20)
[1] 3.141592653589793116
R>
I am sure this is also in the math headers. [ Goes checking: Yup, starting in math.h
. ] Probably multiple times. Grep'ing through other sources can be fruitful too.