GAMMALN in Apple Numbers: log gamma explained
Find ln(Gamma(x)) for positive inputs, including reproducible log-factorial calculations and errors.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: =GAMMALN(5) is approximately 3.17805383034795, because GAMMA(5)=24 and LN(24)=3.178.... Apple’s one-argument syntax is =GAMMALN(pos-x-value); x must be strictly greater than 0, with no optional argument or default. The function is not itself a distribution CDF or an inverse probability function. [A1, C1]
Availability and version history
- Introduced: Documented in Apple’s Formulas and Functions Help 15.4; the original introduction release is not established.
- Availability: Currently documented for Numbers in that help version; it is not a final supported-version endpoint.
- Scope: Shared iWork function help. Availability in individual clients and older releases is not established by this check.
- Checked: October 14, 2026, against the official GAMMALN reference. Documentation check; not a new native test.
Why use GAMMALN instead of GAMMA?
The mathematical gamma function grows very rapidly for large positive x. GAMMALN(x) represents ln(Γ(x)), a logarithmic-scale result that is useful in combinatorics and probability calculations where a product of many terms would be inconvenient or overflow a floating-point representation. For large x, the log itself can remain a moderate number even when Γ(x) becomes enormous. This is a mathematical motivation—not a claim about precisely how Apple’s internal numeric engine avoids overflow. [A1, C1]
Domain caution: The corresponding Apple’s GAMMA help explicitly accepts some negative nonintegers, but GAMMALN does not. Apple’s parameter is named pos-x-value and requires x>0. Thus =GAMMALN(-0.5) is out of documented scope even though =GAMMA(-0.5) is mathematically defined. Do not infer support for logarithms of negative gamma values, a complex log, or GAMMALN’s absolute-value convention used elsewhere. [A1, A4]
Exact syntax, argument type and defaults
=GAMMALN(pos-x-value)
| Position | Official name | Apple type | Required? | Condition | Default |
|---|---|---|---|---|---|
| 1 | pos-x-value |
Number value | Yes | x > 0 | None |
A single numeric cell reference such as B2 qualifies as a numeric argument. The published signature does not establish multi-item lists or range aggregation. Neither a second argument nor a base can be supplied; GAMMALN is natural log, not LOG with a customizable base. [A1, A3]
Reproduce the outputs in a Numbers table
Create a table named LogGammaCases. Type B1 Positive x, C1 GAMMALN, and D1 Meaning. Enter the B-column numbers in rows 2–9, then place =GAMMALN(B2) in C2 and fill C2:C9. The values shown are independent expected results; the examples for x=0.92 and x=0.29 are also Apple-published. [A1, A2, C1]
| Row | B: x | Formula in C | Expected result (approximate) | Meaning |
|---|---|---|---|---|
| 2 | 0.29 | =GAMMALN(B2) |
1.13144836880416 | Apple example |
| 3 | 0.5 | =GAMMALN(B3) |
0.572364942924700 | ln(√π) |
| 4 | 0.92 | =GAMMALN(B4) |
0.051658003497744 | Apple example |
| 5 | 1 | =GAMMALN(B5) |
0 | ln(Γ(1)) |
| 6 | 2 | =GAMMALN(B6) |
0 | ln(Γ(2)) |
| 7 | 5 | =GAMMALN(B7) |
3.17805383034795 | ln(24) |
| 8 | 10 | =GAMMALN(B8) |
12.8018274800815 | ln(9!) |
| 9 | 100 | =GAMMALN(B9) |
359.134205369575 | Large-x illustration |
This table proves neither device-wide compatibility nor how many decimals Numbers actually displays; the outputs were computed by independent mathematics and Apple reference comparison. The surprisingly equal zero outputs for 1 and 2 are both correct because Γ(1)=Γ(2)=1. [C1]
Advanced calculations using a logarithmic gamma
1. Check a small input against LN(GAMMA(x))
=GAMMALN(5)
=LN(GAMMA(5))
Both are mathematically 3.17805383034795. For modest supported positive x, this is a useful self-check; for large x the nested expression may build an enormous intermediate number. Since Apple’s GAMMALN is already the requested log-scale result, it is generally more numerically appropriate than first computing Γ(x) solely to take its logarithm. This numerical motivation is not a native engine benchmark. [A1, A4, A5, C1]
2. Express the log of a factorial without forming the factorial
=GAMMALN(11)
Mathematically this is ln(10!), approximately 15.1044125730755. For positive integer n, GAMMALN(n+1) equals ln(n!), so a cell B2 holding 10 could be used with =GAMMALN(B2+1). This is a conceptual identity, not proof that n can be unbounded in Numbers. [C1]
3. Logarithm of a binomial coefficient
For positive whole-number n and integer k with 0≤k≤n, the following is the log of “n choose k,” not the integer count itself:
=GAMMALN(101)-GAMMALN(51)-GAMMALN(51)
That is mathematically ln(100!/(50!×50!)) ≈ 66.7838416520174. For small n, a final EXP(...) would return an approximate coefficient; for large n avoid assuming the exponentiated result fits into the application’s precision. Do not round a huge approximate coefficient and claim exact integer combinatorics without validating the precision. [A5, C1]
4. A useful cancellation: difference of log gammas
=GAMMALN(5.5)-GAMMALN(4.5)
By gamma recurrence, the exact mathematical result is LN(4.5) ≈ 1.50407739677627. This is a good check for correctly shifted arguments without multiplying a sequence. Very close large inputs can still suffer rounding/cancellation on a finite-precision engine; Numbers-specific error bounds have not been tested. [A5, C1]
5. Interpret a density normalization rather than confusing functions
The density of many statistical distributions uses Γ(alpha) in a denominator. A log-density expression may instead use GAMMALN(alpha) to avoid a large product, but GAMMALN itself is not a probability. If the goal is cumulative gamma probability or a quantile for measured x, consult Apple’s distinct GAMMADIST/GAMMAINV pages rather than using GAMMALN as a CDF. [A6, C1]
Troubleshooting and documented limits
| Problem formula / result | Why it is a problem | Correct approach |
|---|---|---|
=GAMMALN(0) |
Apple explicitly requires x>0. | Use a genuinely positive model input. |
=GAMMALN(-0.5) |
Not valid even if GAMMA(-0.5) is defined. |
Choose an application-appropriate method; don’t invoke a non-Apple abs convention. |
=GAMMALN(5,10) |
No second argument exists. | =GAMMALN(5). |
=GAMMALN(B2:B9) |
Official contract is a scalar numeric value. | Compute per row by copying formula. |
Assuming GAMMALN(5) equals 24 |
GAMMALN returns a logarithm, not Gamma itself. | Compare =GAMMA(5) or =EXP(GAMMALN(5)) for modest positive x. |
| Extremely large x | Infinite/precision limits are not specified in the individual help. | Keep results in logarithmic form and test target Numbers platform. |
| Locale formula rejected | Argument and decimal punctuation or names may differ. | Use Formula Editor autocomplete with English help adapted to local UI. |
Device/version claims that can be made
GAMMALN is present in Apple’s official English 15.4 Functions Help. The separately published Mac feature page lists GAMMA, not GAMMALN, among newly introduced functions; it would be wrong to infer GAMMALN was introduced in 15.4 just because the GAMMALN help URL contains /15.4/. Older-release availability and cross-platform equivalence are unverified. No localization alias was validated. [A1, A7]
Entering these formulas in an Apple Numbers table
Create the named table specified in the examples, type the headings in row 1, and enter numbers as numeric cells, not as pasted strings containing explanatory units. In a formula inside that same table, B2 refers to its B-column row 2; use TableName::B2 when referring from a different table and choose the actual reference token through the Formula Editor if you rename a table. A Numbers sheet can contain several independent tables: this is not an Excel-like single sheet-wide cell grid. Apple’s reference guidance explicitly documents table-qualified references. [A2]
English official examples put commas between arguments and use a dot for decimal numbers. The installed locale may use different function translations, decimal marks, or argument separators; no localized alias of GAMMALN is verified in this review. Choose GAMMALN from the formula browser and reproduce the displayed syntax in your own locale. Do not create another English guide/URL simply because a translated name is discovered. Apple describes the distinction between a number value (scalar argument) and an array or range; the following function-specific scalar arguments have not been shown by Apple to automatically consume entire ranges. [A1, A3]
How to interpret the numbers: Expected outputs below are separately computed using mathematical identities and Python/SciPy/mpmath , or transcribed and separately checked from Apple examples. They are not screenshots, native Apple Numbers execution results, or tested platform behaviour. Display precision can vary with formatting, rounding, locale and software implementation. [C1]
Compatibility, editions and validation limits
This guide documents the English Formulas and Functions Help 15.4 reference, checked 2026-10-13 (UTC). It does not establish behaviour in older Numbers releases, other spreadsheet programs, all devices, or every regional edition. The math checks establish expected values under the documented inputs, but native Numbers execution and round-trip evaluations remain NOT TESTED. The 15.4 help document is evidence of the signature in that documentation edition, not by itself a historical minimum-version claim. [A1]
No Excel or Google Sheets name or error treatment is imported as Apple Numbers evidence. In particular, old-version compatibility, exact overflow thresholds, implicit text-to-number coercion, handling of blank cells, display precision and localized parse rules require native testing before depending on them. All cited official Apple links were checked 2026-10-13 and are listed below. [A1–A3]
Practical troubleshooting (not observed error codes)
The function’s official domain rules are authoritative. The invalid formulas described here are predicted violations of those documented rules, not executions in Numbers; the docs do not give a guaranteed displayed #... token for each failure. First check whether cells are numeric, then arguments and bounds, then table references and the application’s locale. Do not substitute IFERROR to silently hide a model-validation failure. If a computed result seems wrong, reproduce one literal Apple example exactly before converting it into parameterized table cells. [A1–A3]
Sources and validation
- [A1] Apple, GAMMALN, Formulas and Functions Help 15.4, official function description, argument order, domains, examples: https://support.apple.com/guide/functions/gammaln-ffa5a967cb/15.4/web/1.0; checked 2026-10-13 (UTC).
- [A2] Apple, Refer to cells in formulas, Formulas and Functions Help 15.4, table/qualified references: https://support.apple.com/guide/functions/refer-to-cells-in-formulas-ffa550d691/15.4/web/1.0; checked 2026-10-13 (UTC).
- [A3] Apple, Types of arguments and values, Formulas and Functions Help 15.4: https://support.apple.com/guide/functions/types-of-arguments-and-values-ffaa26436a8c/15.4/web/1.0; checked 2026-10-13 (UTC).
- [C1] Independent mathematics / special-function verification with Python, SciPy and mpmath on 2026-10-13 (UTC); using the displayed input cases; this is not an Apple execution citation.
Native-validation limitation: No Numbers execution or screenshots were performed; verify relevant precision, coercion and locale edge cases in the target app.
- [A4] Apple, GAMMA, 15.4: https://support.apple.com/guide/functions/gamma-f47d10e5ac/15.4/web/1.0; checked 2026-10-13.
- [A5] Apple, LN and EXP, 15.4: https://support.apple.com/guide/functions/ln-ffa58520f3/15.4/web/1.0 ; https://support.apple.com/guide/functions/exp-ffa58f0047/15.4/web/1.0; checked 2026-10-13.
- [A6] Apple, GAMMADIST and GAMMAINV, 15.4: https://support.apple.com/guide/functions/gammadist-ffa5a92ddc/15.4/web/1.0 ; https://support.apple.com/guide/functions/gammainv-ffa5b17742/15.4/web/1.0; checked 2026-10-13.
- [A7] Apple, What’s new in Numbers on Mac, 15.4 release and GAMMA feature; does not establish GAMMALN introduction: https://support.apple.com/guide/numbers/whats-new-tan700f60676/mac; checked 2026-10-13.