Statistical functions

GAMMALN.PRECISE

Close: 3,638 of 14,281 recorded answers differ in the last bits, worst 7 ULP

Everything else matches (14,278 in the answer bank and 3 workbook cells). Last-bit means a finite number within 16 ULP of Excel's. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicGAMMALN.PRECISE
BulgarianGAMMALN.PRECISE
CzechGAMMALN.PRECISE
DanishGAMMALN.PRECISE
GermanGAMMALN.PRECISE
GreekGAMMALN.PRECISE
English (Australia)GAMMALN.PRECISE
English (United Kingdom)GAMMALN.PRECISE
English (United States)GAMMALN.PRECISE
SpanishGAMMA.LN.EXACTO
EstonianGAMMALN.PRECISE
FinnishGAMMALN.TARKKA
FrenchLNGAMMA.PRECIS
HebrewGAMMALN.PRECISE
CroatianGAMMALN.PRECISE
HungarianGAMMALN.PONTOS
IndonesianGAMMALN.PRECISE
ItalianGAMMALN.PRECISE
JapaneseGAMMALN.PRECISE
KoreanGAMMALN.PRECISE
LithuanianGAMMALN.PRECISE
LatvianGAMMALN.PRECISE
NorwegianGAMMALN.PRECISE
DutchGAMMA.LN.NAUWKEURIG
PolishROZKŁAD.LIN.GAMMA.DOK
Portuguese (Brazil)GAMMALN.PRECISE
Portuguese (Portugal)LNGAMA.PRECISO
RomanianGAMMALN.PRECISE
RussianГАММАНЛОГ.ТОЧН
SlovakGAMMALN.PRECISE
SlovenianGAMMALN.PRECISE
Serbian (Latin)GAMMALN.PRECISE
SwedishGAMMALN.EXAKT
ThaiGAMMALN.PRECISE
TurkishGAMALN.DUYARLI
UkrainianGAMMALN.PRECISE
VietnameseGAMMALN.PRECISE
Chinese (Simplified)GAMMALN.PRECISE
Chinese (Hong Kong)GAMMALN.PRECISE
Chinese (Traditional)GAMMALN.PRECISE

Names from Microsoft's support site.

What it does

GAMMALN.PRECISE(x)

GAMMALN.PRECISE(x) returns the natural logarithm of the gamma function, ln Γ(x), for x > 0.

The mathematics is set out in full on the GAMMALN page — the integral definition, the recurrence ln Γ(x+1) = ln x + ln Γ(x), strict convexity on (0, ∞), the two zeros at x = 1 and x = 2, the single minimum near x ≈ 1.4616, and Stirling's asymptotic series — and is not repeated here. Microsoft's description of this surface is word-for-word the description of the legacy one: "Returns the natural logarithm of the gamma function, Γ(x)."

The interesting content of this page is not the mathematics. It is the pair relationship, and what the word "PRECISE" in the name does and does not promise.

Arguments

ArgumentMeaningDefault
xThe value at which to evaluate ln Γ. Required.—

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

Quirks

The pair, stated precisely

The .PRECISE suffix belongs to the Excel 2010 renaming of the statistical function set, and in the general case the Handbook's rule holds: a modern dotted name is not guaranteed to be the same computation as its legacy counterpart, and proving identity requires evidence. For this particular pair, unusually, some of that evidence exists — upstream's, not the Handbook's — and it is worth laying out with each claim's warrant attached.

  1. Documented supersession. Microsoft's GammaLn page carries the replacement banner: the function "has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage", and it names GammaLn_Precise. Note the modal verb — may provide improved accuracy. The banner is boilerplate carried by every function in that 2010 renaming, and it promises nothing measurable.
  2. Observed identity, upstream, on one build. EV-MATH-0014 records an Excel-versus-Excel check in which both surfaces resolved to the same implementation and published the same results at every probed point. The record is explicit that this is an identity check and not a pass rate, and that the source publishes no numerator or denominator for it.
  3. The direction of inheritance runs toward the legacy name, not away from it. EV-MATH-0013 records that both of the family's held-out tests were captured through this spelling, so a figure measured on GAMMALN.PRECISE transfers to GAMMALN by that argument and not the reverse. That is the opposite of the usual assumption, in which the older, better-studied surface is the measured one.

Result and edge cases

Returns Number. The edge-case inventory is the one on the GAMMALN page: exact zeros at x = 1 and x = 2, the −ln x behaviour as x → 0⁺, Stirling growth at large x, and #NUM! for x ≤ 0.

Errors

Microsoft's documentation for this surface is worded differently from the legacy one, and the difference is worth noting rather than smoothing over:

ConditionGAMMALN.PRECISE documentationGAMMALN documentation
x is nonnumeric"generates an error"#VALUE!
x ≤ 0"generates an error"#NUM!

The modern page does not name the error values; the legacy page does. The two pages describe the same two conditions, but only one of them tells you what lands in the cell. A reader writing an IFERROR/IFNA guard needs the code, and the documentation for the recommended surface is the one that omits it. Recorded as a documentation gap.

GAMMALN from 3 to 8 is a stored recurrence, and GAMMALN(3) is one unit above ln 2

With RN(v) meaning v rounded to 64 bits on the x87 unit and then stored to binary64, write x = n + y with n the integer part. For 3 < x < 8, Excel forms z = (y+2)(y+3)...(y+n-1) from the left with every product RN, and GAMMALN(x) is RN(RN(ln z) + GAMMALN(2+y)). So answers on this range carry the rounding of a value on [2,3]. x = 3 itself belongs to the band on [2,3], not to this route, and returns 0x3fe62e42fefa39f0, one unit above the stored ln 2, although GAMMALN(3) is exactly ln 2.

Explanation (inferred): That GAMMALN.PRECISE takes the same route is inferred: the 30,000 answers are GAMMALN, and the two functions agree at every shared recorded input tried, including 3.

FormulaExcelMathematical value
GAMMALN(3)
Excel 16.0 build 20131, platform and bitness not recorded, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

x: 3
0x4008000000000000

ln 2, correctly rounded.

0.6931471805599454
0x3fe62e42fefa39f0
0.6931471805599453
0x3fe62e42fefa39ef
GAMMALN.PRECISE(3)
Excel 16.0 build 20131, platform and bitness not recorded, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

x: 3
0x4008000000000000

ln 2, correctly rounded.

0.6931471805599454
0x3fe62e42fefa39f0
0.6931471805599453
0x3fe62e42fefa39ef
GAMMALN(2.020222407046596)
Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading
Inputs and reference value

Number supplied through a cell.

x: 2.020222407046596
0x4000296a5d874ad0

0.008681034861562235
0x3f81c75cc69b54fc
—
GAMMALN(6.020222407046596)
Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading
Inputs and reference value

Number supplied through a cell.

x: 6.020222407046596
0x401814b52ec3a568

mpmath loggamma at 800 bits from the binary64 input, correctly rounded.

4.8220305792560145
0x401349c26258ddb7
4.822030579256015
0x401349c26258ddb8

Inputs, build details and evidence

How to implement

Numerical notes

The algorithmic content — the three-region split (recurrence for small x, minimax rational in the middle, Stirling above a seam), the unbounded relative error in the two narrow bands around the zeros, and the identified structure with its threshold and seam — is set out on the GAMMALN page.

Two points belong specifically here.

"Precise" is a name, not a measurement. Nothing in Microsoft's documentation quantifies the improvement the 2010 renaming promised, and the banner's own wording is "may provide improved accuracy". Where a .PRECISE surface has been checked against its legacy counterpart in this domain, the result so far has been identity rather than improvement. A reader should not choose this spelling expecting better answers; they should choose it because it is the current name.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

GAMMALN.PRECISE · 3 lines · calc-func/src/catalogue/distributions.rs on GitHub
60 gammaln_precise "GAMMALN.PRECISE" (1, 1) [V "x"] |s, a, sv| {
    out(s, sd::gammaln_precise_kernel(num_with_subnormal(s, a, 0)?))
}
gammaln_precise_kernel · 3 lines · calc-func/src/ported/special_dist_family.rs on GitHub
pub fn gammaln_precise_kernel(x: f64) -> Result<f64, WorksheetErrorCode> {
    gammaln_kernel(x)
}

Kernels shared with other functions

Argument and result plumbing

No implementation has been published with a Handbook test suite for this function.

Version differences

The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.

Excel 16.0 buildPlatform and CPUCaptured inputs
19929Windows, bitness not recorded, CPU not recorded44
20131Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics14,262
20228Windows, 64-bit, CPU not recorded16

The record contains no same-input comparison between these environments. Reading different inputs on different builds does not establish either a version change or cross-build agreement.

Recorded environments and comparison details.

Excel 16.0 build 20131

platform not recorded

GAMMALN.PRECISE(3) returned 0.6931471805599454 (0x3fe62e42fefa39f0). Inputs were supplied through cells using Value2. These are controls from this environment, not a same-input comparison with another build.

Observed formulas and results
  • GAMMALN.PRECISE(3) → 0.6931471805599454
    0x3fe62e42fefa39f0 (cell-value2)

Excel 16.0 build 19929

Windows, bitness not recorded, CPU not recorded

44 captured inputs are indexed for this environment. Capture dates are not recorded. This is a reading count, not a comparison with another build.

Excel 16.0 build 20131

Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics

14,262 captured inputs are indexed for this environment. Capture dates: 2026-07-12 to 2026-07-17. This is a reading count, not a comparison with another build.

Excel 16.0 build 20228

Windows, 64-bit, CPU not recorded

16 captured inputs are indexed for this environment. Capture dates: 2026-08-09 to 2026-08-09. This is a reading count, not a comparison with another build.

Alternatives

Relationships

  • GAMMALN — the legacy spelling; the full pair analysis is above, and the numerical treatment lives on that page.
  • GAMMA — the value rather than its logarithm, in the same module and not on the same numeric path: upstream's landed log-gamma kernel is wired only to the two GAMMALN surfaces. LN(GAMMA(x)) and GAMMALN.PRECISE(x) are different computations with different domains, and the first overflows where the second does not.
  • GAMMA.DIST, BETA.DIST, POISSON.DIST, COMBIN, MULTINOMIAL — consumers of log-gamma, directly or through their normalising constants.
  • ERF.PRECISE / ERFC.PRECISE — module siblings that carry the same .PRECISE suffix from the same renaming. Whether those pairs are identical computations is a separate question with its own record, and nothing about this pair transfers to them.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents