FN-VAR.S-001: The variance family uses raw moments with stored steps, and two tests switch it to a centered sum
Excel differs from the mathematical answer · measured · recorded 2026-11-04
With RN(v) meaning v rounded to 64 bits on the x87 unit and then stored to binary64, S the running RN sum of the n values and Q the running RN sum of RN(x*x), the sample variance is RN(RN(Q - RN(RN(S*S)/n))/(n-1)) and the population variance RN(RN(RN(n*Q) - RN(S*S))/RN(n*n)). Excel then uses a centered sum instead, adding RN(d*d) with d = RN(x - mean) and dividing by n-1 or n, when either of two stored tests holds: RN(RN(RN(S*S)/n)/Q) > 0.99, or RN(variance*1000) <= |RN(S/n)|. The STDEV functions are the root of this, rounded to 64 bits and then stored. So the answer depends on which path a call takes: the first two VAR.S calls below differ by a few input steps in two arguments, the first passes the 0.99 test and is correctly rounded, and the second takes the raw moments and lands 76 units high. The next pair shows the size test: scaling the inputs by 4 leaves the first path.
| Call and input route | Inputs | Excel | Correct value | Recorded in |
|---|---|---|---|---|
VAR.S(0.8769085090206681, 1, 1.123091490979332)cell-value2 | number1: 0.87690850902066810x3fec0fa26efa7e14number2: 10x3ff0000000000000number3: 1.1230914909793320x3ff1f82ec882c0f6 | 0.015151515151514950x3f8f07c1f07c1e94 | — | Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading |
VAR.S(0.8769085090206679, 1, 1.1230914909793321)cell-value2 | number1: 0.87690850902066790x3fec0fa26efa7e12number2: 10x3ff0000000000000number3: 1.12309149097933210x3ff1f82ec882c0f7 | 0.0151515151515151380x3f8f07c1f07c1f00 | 0.0151515151515150060x3f8f07c1f07c1eb4 | Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading |
VAR.S(3.244042371786199e-10, 0.00034050419142641947)cell-value2 | number1: 3.244042371786199e-100x3df64afacd3a935anumber2: 0.000340504191426419470x3f3650b65dc7a1d6 | 5.797144172853e-080x3e6f1f88c6bbc51a | — | Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading |
VAR.S(1.2976169487144796e-09, 0.0013620167657056779)cell-value2 | number1: 1.2976169487144796e-090x3e164afacd3a935anumber2: 0.00136201676570567790x3f5650b65dc7a1d6 | 9.275430676564799e-070x3eaf1f88c6bbc519 | 9.2754306765648e-070x3eaf1f88c6bbc51a | Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading |
=VAR.S({157,376.82,189.207,12.38,12.473,483,306.24,324.1852,482.235,78})formula-literal | As typed | 31907.4804533817950x40df28debfbf8a84 | 31907.4804533817770x40df28debfbf8a7f | Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA |
STDEV.S(0, 1, 1.031052478719249)cell-value2 | number1: 00x0000000000000000number2: 10x3ff0000000000000number3: 1.0310524787192490x3ff07f30e248f14c | 0.58651988745874540x3fe2c4c55ae2d85e | — | Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading |
Correct value: Exact rational variance of the binary64 inputs, correctly rounded.
Correct value: Exact rational variance of the binary64 inputs, correctly rounded.
Correct value: Exact rational variance of the binary64 inputs, correctly rounded.
Basis: All 14,679 recorded rows of the twelve functions match: VAR.S, VAR.P, VAR, VARP, VARA, VARPA, STDEV.S, STDEV.P, STDEV, STDEVP, STDEVA and STDEVPA. Six of those rows separate the stored steps from plain binary64. 910 fresh scalar variance readings (Excel build 20527) replay exactly in rational arithmetic. Four cancellation edges were bisected to adjacent inputs; sixteen triples chosen to separate the stored ratio from 0.99*Q and from a division by 0.99 all agree with the ratio, where 0.99*Q misses all 16 and the division 14. Seven of eight magnitude brackets reach adjacent inputs, and sixteen chosen roots all need the 64-bit root followed by a store.
Inferred: These tests were located with scalar arguments in separate cells; that the same edges hold for ranges and arrays is inferred, and their readings have not been taken. RN(variance*1000) <= |mean| is not separated from the rearrangement variance <= |mean|/1000. That a raw moment which overflows also takes the centered sum is inferred from recorded answers that stay finite.
Open: Whether the two tests keep the same edges for ranges and arrays.
Evidence and capture sources
- DnaCalc · crates/calc-func/src/ported/variance_common.rs 9c23b24e8d0a6bc913f16bc169f46f80d4e6bb18 · variance_from_values the rules in the product; the commit message carries the row counts
- DnaCalc · crates/calc-func/tests/f1_stats.rs 9c23b24e8d0a6bc913f16bc169f46f80d4e6bb18 · variance_cancellation_guard_stores_the_ratio recorded answers pinned
- DnaCalc · crates/calc-func/witness-status.tsv af74247e1ed54f0b535143f1305261b98d80d18e · rows matched per function
- DnaCalc-Research · evidence/round25/variance-published-canonical-scope-receipt.json a547d79ed61948cfd5f5d49f8c5a2a071ad37635 · the 14,679 rows before and after
- DnaCalc · crates/calc-func/tests/f1_stats.rs 9c23b24e8d0a6bc913f16bc169f46f80d4e6bb18 · variance_cancellation_guard_keeps_the_observed_edge
- DnaCalc · crates/calc-func/tests/f1_stats.rs 9c23b24e8d0a6bc913f16bc169f46f80d4e6bb18 · variance_cancellation_guard_keeps_the_observed_edge
- DnaCalc · crates/calc-func/tests/f1_stats.rs 9c23b24e8d0a6bc913f16bc169f46f80d4e6bb18 · variance_centered_guard_uses_the_absolute_mean
- DnaCalc · crates/calc-func/tests/f1_stats.rs 9c23b24e8d0a6bc913f16bc169f46f80d4e6bb18 · variance_centered_guard_uses_the_absolute_mean
- DnaCalc · crates/calc-func/tests/captures/catalogue/sections/dcj9k_statistics.capture.json c9f9d354165d2c20b9455c32582ea50baac7ba73 · sheet dcj9k_statistics, row 3, column 4
- DnaCalc · crates/calc-func/tests/f1_stats.rs 9c23b24e8d0a6bc913f16bc169f46f80d4e6bb18 · stdev_stores_the_extended_square_root