Gamma Function Calculator screenshot

Gamma Function Calculator

Evaluate the gamma function for real x, with its logarithm, a stated accuracy and the poles named.

Privacy First
0 Runs
Updated 2026-11-22
Runs in your browser
No sign-up, no upload
Exact where arithmetic allows

Gamma Function Calculator

Evaluate the gamma function for real x, with its logarithm, a stated accuracy and the poles named.

What the page prints, and what it refuses

Every figure is printed with the rule or formula that produced it, and any numerical tolerance is stated on the result rather than implied. The page refuses an input the formula does not define and names the value it read; it prints no answer it cannot support.

The calculation runs entirely in this browser tab; nothing is uploaded.

The gamma function extends the factorial to real and negative arguments. Γ(5) is 24, which is 4!, and the page prints both the value and its logarithm so a very large result stays readable.

Below one half the reflection formula is used; otherwise the Lanczos approximation with g = 7 and nine coefficients gives a relative error of about 1e-13. Poles at zero and the negative integers are refused by name.

What the approximation guarantees

Lanczos evaluates ln Γ directly for x at least one half, then exponentiation recovers Γ. For x below one half, Γ(x) = π ÷ (sin(πx)·Γ(1 − x)) reflects the argument into that range.

The approximation is not exact, and the page says so: relative error about 1e-13 across the accepted range. Above 171.7 the value overflows a double, and the page refuses rather than printing Infinity.

How to use Gamma Function Calculator

Enter x as a real number that is not zero or a negative integer, then press Run.

The result prints Γ(x), ln Γ(x), the method and the accuracy. A positive whole argument also prints the factorial identity.

What to Expect

Best for

  • Evaluating Γ at a real argument
  • Checking the factorial identity
  • Getting ln Γ without overflow

Not ideal for

  • A pole at 0 or a negative integer
  • Arguments above 171.7
  • Exact rational values for general x

What this tool keeps

  • x exactly as a double

What may need cleanup

  • Nothing: the value is a final double

Common errors

  • A pole is refused with the reason
  • An argument above 171.7 is refused for overflow

Example use cases

  • Check Γ(5) = 24
  • Evaluate Γ(0.5) = √π
  • See that Γ(−0.5) is negative

Sample input

x = 5

Sample output

Γ(5) = 24 and ln Γ(5) = 3.17805383

Who this is for

  • Students meeting the gamma function
  • Readers checking a factorial identity

Frequently asked questions

Why is Γ(5) equal to 24?

For a positive whole n, Γ(n) = (n − 1)!. Γ(5) is therefore 4! = 24, and the page prints that identity rather than leaving the connection implicit.

What is Γ(0.5)?

The square root of π, about 1.77245385. The Lanczos path evaluates it directly, and the page prints eight decimals.

Why is there no value at zero?

Γ has a simple pole there: the value grows without bound as x approaches zero. The page refuses it instead of returning Infinity.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.