TMath::Factorial(int n)

Hello,

I am currently taking a course in Thermal Physics, and I was curious to see how close Stirling’s approximation is by comparing to actual factorial.

I built a small C code, for “unsigned long long”, I am finding that the factorial overloads after 20.
I am finding that TMath::Factorial(int n) overloads after 170.

I am curious to find out how TMath::Factorial(int n) is built, but
https://root.cern.ch/root/html/TMath.html#TMath:Factorial

Didn’t really explain how the function was built.

Could someone explain how TMath::Factorial(int n) was built? I am curious because I want to see what data type it used and etc.

Double_t TMath::Factorial(Int_t n)

Thank you, I am quite surprised on how it was built.