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
=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:
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.
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.
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.
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.
pubfnln_kernel(n: f64) -> Result<f64, WorksheetErrorCode> {
if n <= 0.0 {
returnErr(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))
}
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 build
Platform and CPU
Captured inputs
19929
Windows, bitness not recorded, CPU not recorded
45
20131
Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics
349
18429
Windows, 64-bit, Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
52
20131
Windows, 64-bit, AMD Ryzen 7 4800H with Radeon Graphics
52
20228
Windows, 64-bit, CPU not recorded
90
20430
Windows, 64-bit, CPU not recorded
1,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.
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.
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.
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.
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.
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.
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.
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. Code
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. Code
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.