Contact

GAMMALN Function (OpenOffice Calc)

Statistical Intermediate OpenOffice Calc

Use GAMMALN in Apache OpenOffice for log-gamma values, large-factorial calculations and stable probability formulas, with an explicit positive-input domain.

Verification status: Eight reference formulas and 2 boundary cases were recalculated in Apache OpenOffice 4.1.16 on Linux x86-64, Build 9816 after XLSX import; other explanatory calculations are independent references. How formula examples are checked

Quick answer: =GAMMALN(1) has independent reference value 0.

Availability and version history

  • Introduced: First release not established; documented by OpenOffice.org 3.3.
  • Supported in: Apache OpenOffice 4.1.16; this is not a final supported version.
  • Scope: Desktop Calc with English semicolon-separated formulas. Locale and other-product contracts may differ.
  • Checked: October 14, 2026. Eight reference formulas and 2 boundary cases were recalculated in Apache OpenOffice 4.1.16 on Linux x86-64, Build 9816 after XLSX import; other explanatory calculations are independent references.

What GAMMALN returns

GAMMALN returns the natural logarithm of the gamma function for a positive input. It computes ln(Γ(x)), not Γ(ln(x)) and not a base-10 logarithm. For a positive integer n, the result is ln((n−1)!), connecting the function to factorial and combinatorial calculations. Release implementation.

Syntax and arguments

=GAMMALN(Number)

Exactly one numeric argument is required, and the inspected evaluator accepts it only when Number>0. Zero and negative values are invalid, including negative nonintegers for which GAMMA itself may have a finite signed result. This function is not a general log-absolute-gamma extension on the negative axis.

The numeric helper supplies the corresponding endpoint and evaluation branches.

Reproducible reference examples

Values below are rounded to twelve decimal places. These eight formulas were also recalculated in Apache OpenOffice 4.1.16 on Linux x86-64, Build 9816 after XLSX import. Saved results agree with the independent references to the checked precision. The saved 12-decimal display for GAMMALN(10) ended in 480082, while the higher-precision reference rounds to 480081; this last-place display difference is retained rather than presented as exact agreement.

Formula Independent reference
=GAMMALN(0.5) 0.572364942925
=GAMMALN(1) 0
=GAMMALN(1.5) -0.120782237635
=GAMMALN(2) 0
=GAMMALN(3) 0.69314718056
=GAMMALN(5) 3.178053830348
=GAMMALN(10) 12.801827480081
=GAMMALN(200) 857.933669825857

Practical worksheet

For an integer factorial, use =GAMMALN(n+1) to calculate its natural logarithm. The value at 5 is ln(4!), approximately 3.178053830348. The values at 1 and 2 are both 0 because Γ(1)=Γ(2)=1.

The value at 200 is approximately 857.933669825857. Directly calculating 199! would exceed ordinary double-precision numeric range, while its logarithm remains a manageable number. Keep the log result if that is what the subsequent calculation needs; exponentiating it immediately recreates the original range problem.

Advanced interpretation and checks

For positive a and b, the logarithm of the beta function is =GAMMALN(a)+GAMMALN(b)-GAMMALN(a+b). At a=2 and b=3 it is approximately −2.484906649788. Exponentiating that moderate value gives 1/12 without separately multiplying and dividing large gamma values.

A log binomial mass for an integer 0≤k≤n and 0<p<1 can be assembled as GAMMALN(n+1)−GAMMALN(k+1)−GAMMALN(n−k+1)+k×LN(p)+(n−k)×LN(1−p). For n=10, k=2 and p=0.2, exponentiating the result gives 0.301989888. Handle p=0 or 1 separately, because the log expression contains LN(0) even where the limiting binomial probability is well defined.

Boundaries and troubleshooting

The implementation explicitly rejects nonpositive inputs. It does not compute LN(ABS(GAMMA(x))) for negative nonintegers. A log-gamma value may itself be negative for a positive input: GAMMALN(1.5) is approximately −0.120782237635, because Γ(1.5) lies between 0 and 1.

Log-domain arithmetic reduces some overflow risks but is not a universal accuracy guarantee. Subtracting two nearly equal large logarithms can still lose digits. For very large inputs, closely spaced parameters or extreme probability tails, use additional numerical checks. Keep full cell precision through the calculation and round only the final displayed result.

Observed boundary checks

These additional cases were saved from the same 4.1.16 import session. Error displays are errors even where the ODS numeric attribute is zero.

Formula Native result or error
=GAMMALN(0) Err:502
=GAMMALN(-0.5) Err:502

Evidence and checking scope

The saved import workbook retained the stated formula identities. A deliberately stale SUM cache became 3 and an uncached SUM became 7, confirming recalculation. The observed scope is the named release and method only; explanatory composite formulas are independently calculated unless specifically listed among the native cases. Other releases, locales and extreme-value limits were not established by these ordinary examples.