double sph_legendre(unsigned l, unsigned m, double theta); float sph_legendref(unsigned l, unsigned m, float theta); long double sph_legendrel(unsigned l, unsigned m, long double theta);

Yℓm(θ,0)

where

Yℓm(θ,ϕ)=(−1)m[(2ℓ+1)4π(ℓ−m)!(ℓ+m)!]1/2Pℓm(cosθ)eimϕ , for |m|≤ℓ,

and l is l, m is m, and θ is theta.