A uniform version of Stirling's formula