pub fn gamma_func(x: f64) -> f64
High-precision Gamma function approximation (for real x)
This is a direct port of the C++ gamma_func implementation