Math and trigonometry functions

LN

Matches all 1,856 recorded answers

Recorded: 1,685 in the answer bank and 171 workbook cells. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicLN
BulgarianLN
CzechLN
DanishLN
GermanLN
GreekLN
English (Australia)LN
English (United Kingdom)LN
English (United States)LN
SpanishLN
EstonianLN
FinnishLUONNLOG
FrenchLN
HebrewLN
CroatianLN
HungarianLN
IndonesianLN
ItalianLN
JapaneseLN
KoreanLN
LithuanianLN
LatvianLN
NorwegianLN
DutchLN
PolishLN
Portuguese (Brazil)LN
Portuguese (Portugal)LN
RomanianLN
RussianLN
SlovakLN
SlovenianLN
Serbian (Latin)LN
SwedishLN
ThaiLN
TurkishLN
UkrainianLN
VietnameseLN
Chinese (Simplified)LN
Chinese (Hong Kong)LN
Chinese (Traditional)LN

Names from Microsoft's support site.

What it does

LN(number)

LN(number) returns the natural logarithm of a positive number. It answers the question “what exponent of e gives this number?” Microsoft documents it as the inverse of EXP. Use it for multiplicative growth, log returns and transformations of positive data.

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.

=LN(8) is about 2.079441541679836. Dividing by LN(2) converts that exponent to base two: =LN(8)/LN(2) is about 3. =LN(1) returns zero.

For a growth factor of 1.25, =LN(1.25) gives a continuously compounded rate of about 0.2231435513142098. These are rounded mathematical examples; they do not promise a particular last bit on every machine.

Quirks

The documented domain is positive real numbers. The current calculation code returns #NUM! for zero or a negative value; Microsoft's opened function page does not specify that error code. Numeric conversion and elementwise array handling happen outside the logarithm kernel.

If you form LN(1+x) for a tiny x, the addition may already have rounded to 1, so LN receives exactly one and returns zero. A more accurate logarithm cannot recover a perturbation lost before the call. PMT uses a separate small-rate series for this reason.

Recorded answers differ between two machines for some identical inputs; their Excel builds and operating systems also differ. A host-native logarithm is therefore an implementation choice with an environment scope. The old battery also admits a subnormal directly to the kernel while a separate Excel input route flushed that value to zero: those are different input paths, not an established contradiction in LN itself.

How to implement

The current compatibility implementation evaluates an x87 instruction chain, rather than calling the language's log:

  1. Convert the accepted binary64 input exactly to an extended value with a 64-bit significand. Reject x<=0 at the worksheet surface; return zero for x=1.
  2. Load the resident extended constant ln(2). In the source model it is the exact binary value 0xB17217F7D1CF79AC * 2^-64; do not replace it with a binary64 constant.
  3. Evaluate the modeled FYL2X instruction with that constant and x, meaning the instruction's approximation to ln(2)*log2(x). Keep the instruction result extended until the final assignment.
  4. Store once to binary64 with round-to-nearest, ties-to-even. Apply the worksheet error and input policies outside this kernel.

For x=1, step 1 returns 0 without a transcendental call. For x=8, step 3 uses log2(8)=3; the result is near 3*ln(2), giving about 2.079441541679836 after storage.

This specifies the chain but leaves an instruction model to implement. The product has native x87 and software backends; the CPU's approximation and the software model are not justified by substituting an ideally rounded mathematical logarithm. The fingerprint work identifies constants within declared instruction models on measured discriminants. Private instruction internals, unmeasured input regions and agreement across CPUs remain outside that result.

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.

LN · 1 lines · calc-func/src/catalogue/math.rs on GitHub
26 ln "LN" (1, 1) [V "number"] |s, a, sv| { unary(s, a, k::ln_fn::ln_kernel) }
ln_kernel · 7 lines · calc-func/src/ported/ln_fn.rs on GitHub
pub fn ln_kernel(n: f64) -> Result<f64, WorksheetErrorCode> {
    if n <= 0.0 {
        return Err(WorksheetErrorCode::Num);
    }
    // Excel's LN is the x87 `fldln2` + `fyl2x` fused op; match it bit-for-bit.
    Ok(crate::ported::excel_numeric::excel_log(n))
}

Kernels shared with other functions

Argument and result plumbing

  • num catalogue/kit
  • out catalogue/kit

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 recorded45
20131Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics349
18429Windows, 64-bit, Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz52
20131Windows, 64-bit, AMD Ryzen 7 4800H with Radeon Graphics52
20228Windows, 64-bit, CPU not recorded90
20430Windows, 64-bit, CPU not recorded1,227
  • XC-LN-001: build 19929 versus build 20430; 2 same-input pairs, 0 differing answers. Compared axes: excel-build. Numeric answers were compared by their recorded binary64 bits; other answers by typed value.
  • XC-LN-002: build 20131 versus build 18429; 52 same-input pairs, 17 differing answers. Compared axes: cpu, excel-build, os. Numeric answers were compared by their recorded binary64 bits; other answers by typed value.

The differing machines changed Excel build and other recorded environment properties together. These observations do not isolate a build-only or CPU-only cause. The linked record retains each input, answer, and recheck status.

A recorded example, XD-LN-001: the input 3.677168983357276e-222 has bits 0x11f544676cf1bf2f. On 2026-07-03, build 20131 on AMD Ryzen 7 4800H with Radeon Graphics returned -509.8717474865596 (0xc07fddf2ad7e124d). On the other machine, 2026-07-05, build 18429 on Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz returned -509.87174748655957 (0xc07fddf2ad7e124c). These answers differ by one unit in the last place. Each machine ran this probe once; no repeat is recorded. The input was placed in a cell through Range.Value2 and its round trip was checked, rather than entered as a rounded decimal formula literal.

Agreement on these compared inputs does not establish agreement on unmeasured inputs.

Recorded environments and comparison details.

Retained controls from the indexed captures:

Build and recorded CPUCaptured call or argumentsExcel result
19929, CPU not recorded=LN(0.00878906250000000)-4.734247228263234 (0xc012efde816246e6)
20131, AMD Ryzen 7 4800H with Radeon GraphicsLN(1.5)0.4054651081081644 (0x3fd9f323ecbf984c)
20228, CPU not recordedLN(0.93229377243277)-0.0701073074907403 (0xbfb1f28d70e222ed)
20430, CPU not recordedLN(2)0.6931471805599453 (0x3fe62e42fefa39ef)

These are earlier recorded answers, not new Excel runs or an additional cross-build comparison. The function JSON retains each source locator, exact argument bits where available, and input-route status. Call notation does not imply that captured binary64 values were entered as decimal formula literals.

Excel 16.0 build 19929

Windows, bitness not recorded, CPU not recorded

45 captured inputs are indexed for this environment. Capture dates are not recorded. This is a reading count, not a comparison with another build. Retained control =LN(0.00878906250000000) returned -4.734247228263234 (0xc012efde816246e6). The selected archive row does not record its input plumbing; no input route is inferred.

Observed formulas and results
  • =LN(0.00878906250000000) → -4.734247228263234
    0xc012efde816246e6 (not-recorded)

Excel 16.0 build 20131

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

349 captured inputs are indexed for this environment. Capture dates: 2026-07-21 to 2026-07-23. This is a reading count, not a comparison with another build. Retained control LN(1.5) returned 0.4054651081081644 (0x3fd9f323ecbf984c). The selected archive row does not record its input plumbing; no input route is inferred.

Observed formulas and results
  • LN(1.5) → 0.4054651081081644
    0x3fd9f323ecbf984c (not-recorded)

Excel 16.0 build 18429

Windows, 64-bit, Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz

52 captured inputs are indexed for this environment. Capture dates: 2026-07-05 to 2026-07-05. This is a reading count, not a comparison with another build. The indexed same-input control LN(3.677168983357276e-222) returned -509.87174748655957 (0xc07fddf2ad7e124c); XD-LN-001 changed CPU, Excel build and OS together and remains not-rechecked.

Observed formulas and results
  • LN(3.677168983357276e-222) → -509.87174748655957
    0xc07fddf2ad7e124c (cell-value2)

Excel 16.0 build 20131

Windows, 64-bit, AMD Ryzen 7 4800H with Radeon Graphics

52 captured inputs are indexed for this environment. Capture dates: 2026-07-03 to 2026-07-03. This is a reading count, not a comparison with another build. The indexed same-input control LN(3.677168983357276e-222) returned -509.8717474865596 (0xc07fddf2ad7e124d); XD-LN-001 changed CPU, Excel build and OS together and remains not-rechecked.

Observed formulas and results
  • LN(3.677168983357276e-222) → -509.8717474865596
    0xc07fddf2ad7e124d (cell-value2)

Excel 16.0 build 20228

Windows, 64-bit, CPU not recorded

90 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. Retained control LN(0.93229377243277) returned -0.0701073074907403 (0xbfb1f28d70e222ed). The capture specifies exact-double bulk Value2 cell input.

Observed formulas and results
  • LN(0.93229377243277) → -0.0701073074907403
    0xbfb1f28d70e222ed (cell-value2)

Excel 16.0 build 20430

Windows, 64-bit, CPU not recorded

1,227 captured inputs are indexed for this environment. Capture dates: 2026-09-29 to 2026-09-29. This is a reading count, not a comparison with another build. Retained control LN(2) returned 0.6931471805599453 (0x3fe62e42fefa39ef). The capture specifies exact-double bulk Value2 cell input.

Observed formulas and results
  • LN(2) → 0.6931471805599453
    0x3fe62e42fefa39ef (cell-value2)

Recorded variants

Excel buildCPURecorded behaviourOur RustEvidence
16.0 build 18429Intel Coffee Lake (Windows, 64-bit)On 17 recorded inputs this environment's answer is 1 ULP from the answer recorded in 16.0 build 20131, AMD Zen 2 (Windows, 64-bit). CPU, Excel build and operating system all differ between the two machines, so the cause is not isolated.Run on Intel Core Processor (Haswell, no TSX): gives this answer on 17 of 17 of these inputs. CodeExcelFunctionsHandbook · content/evidence/measurements/excel-exp-ln-cross-cpu-2026-07/ExcelExpData_GenuineIntel_20260705-191433.json 1b00c7bdb28624b0f2c3785586e076414d9d92bb · XD-LN-001,XD-LN-002,XD-LN-003,XD-LN-004,XD-LN-005,XD-LN-006,XD-LN-007,XD-LN-008,XD-LN-009,XD-LN-010,XD-LN-011,XD-LN-012,XD-LN-013,XD-LN-014,XD-LN-015,XD-LN-016,XD-LN-017 not rechecked
16.0 build 20131AMD Zen 2 (Windows, 64-bit)On 17 recorded inputs this environment's answer is 1 ULP from the answer recorded in 16.0 build 18429, Intel Coffee Lake (Windows, 64-bit). CPU, Excel build and operating system all differ between the two machines, so the cause is not isolated.Not run on this CPU. On x86_64 the kernel executes the CPU's own x87 instructions, so its answer follows the machine; on Intel Core Processor (Haswell, no TSX) it gave this answer on 0 of 17. CodeExcelFunctionsHandbook · content/evidence/measurements/excel-exp-ln-cross-cpu-2026-07/ExcelExpData_AuthenticAMD_20260703-223049.json 1b00c7bdb28624b0f2c3785586e076414d9d92bb · XD-LN-001,XD-LN-002,XD-LN-003,XD-LN-004,XD-LN-005,XD-LN-006,XD-LN-007,XD-LN-008,XD-LN-009,XD-LN-010,XD-LN-011,XD-LN-012,XD-LN-013,XD-LN-014,XD-LN-015,XD-LN-016,XD-LN-017 not rechecked

Alternatives

Use LOG for an explicit base, LOG10 for base ten, and IMLN for a principal complex logarithm. EXP converts a natural-log result back to a positive scale. For tiny financial rates, see the separate series in PMT before constructing 1+rate.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents