GAMMA Function in LibreOffice Calc — Tested Examples
Evaluate LibreOffice GAMMA beyond integers. Calculate half-integer and negative-noninteger values, check recurrence and distinguish gamma from gamma-distribution functions.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: GAMMA evaluates the mathematical gamma function. Positive integers reproduce shifted factorials; noninteger values require the broader gamma definition.
Availability and version history
- Introduced: Documented by LibreOffice 26.8.1.1; original introduction not established.
- Availability: Supported in LibreOffice 26.8.1.1, verified against its function registry. This identifies a supported release, not a final working version.
- Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
- Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.
Returns the value of the Gamma function. For positive integers n, GAMMA(n) equals (n−1)!, so GAMMA(5)=24 and GAMMA(4)=6.
Syntax and arguments
=GAMMA(Number)
LibreOffice Calc formulas generally separate arguments with semicolons (;).
| Argument | Explanation |
|---|---|
Number |
The value for which the Gamma function is to be calculated. |
Worked examples
Example 1: Compute the gamma function at a positive integer
=GAMMA(5)
Expected result: 24. This value was returned in the LibreOffice Calc 25.2 test.
Example 2: Gamma(4) is 3 factorial
=GAMMA(4)
Expected result: 6. This value was returned in the LibreOffice Calc 25.2 test.
How to interpret the result
For positive integers n, GAMMA(n) equals (n−1)!, so GAMMA(5)=24 and GAMMA(4)=6.
Mistakes and troubleshooting
- Check inputs and assumptions: The function is undefined at zero and negative integers.
- Check argument order and format: Strings go in quotes, cell references do not. Functions that return arrays may require special entry.
- Verify your own data: Reproduce the example first. If your formula returns an error, inspect the referenced cells and individual argument values.
Additional worked application and edge cases
Why noninteger inputs matter
The gamma function extends factorial-like behavior beyond positive integers. The familiar relationship is GAMMA(n)=(n−1)! for positive integers, not n!. For many noninteger inputs the result is still a finite real value.
It is undefined at 0 and every negative integer. Negative nonintegers are a different case and can have valid positive or negative values. Do not reject every negative argument merely because the singularities include negative integers.
Stepwise example: half-integer values
Enter 0.5, 1.5, 2.5, -0.5 and -1.5 in A2:A6. Enter =GAMMA(A2) in B2 and copy down.
| Input | Independently expected value |
|---|---|
| 0.5 | 1.7724538509 |
| 1.5 | 0.8862269255 |
| 2.5 | 1.3293403882 |
| -0.5 | -3.5449077018 |
| -1.5 | 2.3632718012 |
The first value is SQRT(PI()). The others follow from the recurrence GAMMA(x+1)=x×GAMMA(x), avoiding the undefined nonpositive integers. These are mathematical controls calculated independently, not additional native Calc tests.
Second example: verify the recurrence
For x=2.5, =GAMMA(3.5)/GAMMA(2.5) is expected to be approximately 2.5. The numerator is approximately3.3233509704. This checks the shift in the gamma argument rather than applying the positive-integer factorial identity where it does not belong.
At x=-0.5, the recurrence gives GAMMA(0.5)=(-0.5)×GAMMA(-0.5), consistent with the sign and magnitude in the table. Near a pole, however, small input changes can produce large differences; the recurrence is not an excuse to round an input onto a singularity.
Advanced application: a simple beta-integral factor
For positive a and b, the mathematical beta-function factor is GAMMA(a)×GAMMA(b)/GAMMA(a+b). Using a=0.5 and b=0.5 gives:
=GAMMA(0.5)*GAMMA(0.5)/GAMMA(1)
Expected value is approximately 3.1415926536, equal to PI(). This demonstrates a useful normalization identity with small, well-behaved arguments. It does not claim that the same direct multiplication is numerically safe for arbitrarily large arguments.
Domain, overflow and related names
Zero and negative integers are poles; an error there is not repaired by applying ABS to the result. Large positive arguments can exceed Calc’s numeric range, and very small or near-singular values can lose precision. No exact platform-independent overflow cutoff is claimed without execution evidence.
For positive-domain calculations involving very large products or ratios, logarithmic formulations using GAMMALN may reduce overflow risk, but only when their domain and algebra are appropriate. A log-gamma function does not automatically preserve signs for all negative noninteger cases.
LibreOffice explicitly warns that GAMMAINV is not the inverse of GAMMA; it is an inverse gamma-distribution function. GAMMA.DIST/GAMMADIST describe probability distributions, while this page’s GAMMA evaluates the gamma mathematical function itself.
Verification scope for this addition: These added results were independently calculated or derived from the cited documentation/source. They were not newly tested in LibreOffice Calc. The original example-specific Calc 25.2.3.2 claims elsewhere on this page remain historical and apply only to those original examples. The cited 26.8.1.1 source tag is a code reference, not a claim of a new run in that release.
Related functions
Tested version and primary reference
2 example(s) on this page passed real calculations in LibreOffice Calc 25.2.3.2. This is not a claim about every possible input or other spreadsheet applications.