var _gamP … var _gamQ … var _gamS … // Gamma function computed by Stirling's formula. // The pair of results must be multiplied together to get the actual answer. // The multiplication is left to the caller so that, if careful, the caller can avoid // infinity for 172 <= x <= 180. // The polynomial is valid for 33 <= x <= 172; larger values are only used // in reciprocal and produce denormalized floats. The lower precision there // masks any imprecision in the polynomial. func stirling(x float64) (float64, float64) { … } // Gamma returns the Gamma function of x. // // Special cases are: // // Gamma(+Inf) = +Inf // Gamma(+0) = +Inf // Gamma(-0) = -Inf // Gamma(x) = NaN for integer x < 0 // Gamma(-Inf) = NaN // Gamma(NaN) = NaN func Gamma(x float64) float64 { … } func isNegInt(x float64) bool { … }