Statistical functions
T.DIST.2T
Close: 1 of 4 recorded answers differ in the last bits, worst 11 ULP
Everything else matches (4 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
| Language | Name in Excel |
|---|---|
| Arabic | T.DIST.2T |
| Bulgarian | T.DIST.2T |
| Czech | T.DIST.2T |
| Danish | T.FORDELING.2T |
| German | T.DIST.2T |
| Greek | T.DIST.2T |
| English (Australia) | T.DIST.2T |
| English (United Kingdom) | T.DIST.2T |
| English (United States) | T.DIST.2T |
| Spanish | DISTR.T.2C |
| Estonian | T.DIST.2T |
| Finnish | T.JAKAUMA.2S |
| French | LOI.STUDENT.BILATERALE |
| Hebrew | T.DIST.2T |
| Croatian | T.DIST.2T |
| Hungarian | T.ELOSZLÁS.2SZ |
| Indonesian | T.DIST.2T |
| Italian | T.DIST.2T |
| Japanese | T.DIST.2T |
| Korean | T.DIST.2T |
| Lithuanian | T.DIST.2T |
| Latvian | T.DIST.2T |
| Norwegian | T.DIST.2T |
| Dutch | T.DIST.2T |
| Polish | ROZKŁ.T.DS |
| Portuguese (Brazil) | T.DIST.2T |
| Portuguese (Portugal) | DIST.T.2C |
| Romanian | T.DIST.2T |
| Russian | СТЬЮДЕНТ.РАСП.2Х |
| Slovak | T.DIST.2T |
| Slovenian | T.DIST.2T |
| Serbian (Latin) | T.DIST.2T |
| Swedish | T.FÖRD.2T |
| Thai | T.DIST.2T |
| Turkish | T.DAĞ.2K |
| Ukrainian | T.DIST.2T |
| Vietnamese | T.DIST.2T |
| Chinese (Simplified) | T.DIST.2T |
| Chinese (Hong Kong) | T.DIST.2T |
| Chinese (Traditional) | T.DIST.2T |
Names from Microsoft's support site.
What it does
T.DIST.2T(x, deg_freedom)
T.DIST.2T(x, deg_freedom) returns the two-tailed area of Student's t-distribution with
ν degrees of freedom:
T.DIST.2T(x, ν) = P(|T| > x) = 2 · P(T > x) = 2 · (1 − F(x; ν))
for x ≥ 0, where F is the cumulative distribution function given on
T.DIST. Because the t-distribution is symmetric about zero,
the two tails are equal and the factor of two is exact rather than an approximation.
In terms of the regularized incomplete beta function, again exactly:
T.DIST.2T(x, ν) = I_{ν/(ν+x²)}(ν/2, ½)
— note that the ½ prefactor that appears in the one-tail form has cancelled against the
doubling. The two-tail area is, in the beta parameterization, the simpler object of the three
t surfaces.
Domain and range: x ≥ 0 (Microsoft documents #NUM! below zero), ν > 0. The value falls
strictly from 1 at x = 0 to 0 as x → ∞. T.DIST.2T(0, ν) = 1 exactly, for every ν: the
whole distribution is more than zero away from zero in absolute value, apart from a null set.
Elementary closed forms at the small integer degrees of freedom:
| ν | T.DIST.2T(x, ν) for x ≥ 0 |
|---|---|
| 1 | 1 − 2·arctan(x)/π |
| 2 | 1 − x / sqrt(x² + 2) |
| ν → ∞ | 2(1 − Φ(x)) = ERFC(x/sqrt 2) |
That ν = 2 row is worth pausing on: the two-tail t-distribution at two degrees of freedom is an elementary rational-algebraic function, computable to the last bit with a square root and a division. Anything an implementation publishes there can be checked against arithmetic.
Arguments
| Argument | Meaning | Required |
|---|---|---|
x | The numeric value at which the distribution is evaluated. Documented as non-negative. | Yes |
deg_freedom | ν, "an integer indicating the number of degrees of freedom" (Microsoft). | Yes |
x < 0 is documented as #NUM!. This is the one member of the modern t trio that keeps the
legacy TDIST domain restriction, and it is worth knowing why it is not merely legacy
baggage: P(|T| > x) for negative x is identically 1, so the natural extension is a constant
and carries no information. Refusing it is a defensible design choice rather than an oversight —
though it does mean T.DIST.2T is not a total function on the reals the way T.DIST.RT is
documented to be.
The page describes deg_freedom as an integer and does not say what a non-integer value does.
The inverse pages (T.INV, T.INV.2T) document truncation for the same parameter; the three
T.DIST* pages are silent.
Numeric slots take ordinary to-number coercion; see Coercion and lifting.
Try it
Quirks
Result and edge cases
Returns Number, a probability in (0, 1].
x = 0is exactly 1 — one of only two exact values this surface has, and free to check.- Large
xgives a smallp-value decaying likex^(−ν). As withT.DIST.RT, the value stays representable and informative deep into the tail provided it is not formed by subtraction from one. - Small
x, near zero, is the opposite hazard: here the answer is close to 1, and the interesting quantity is1 − T.DIST.2T(x, ν), which no Excel surface exposes directly. A reader wanting the central probability accurately should useT.DIST(x, ν, TRUE) − T.DIST(−x, ν, TRUE), or, better,2·T.DIST(x, ν, TRUE) − 1— and should know that all three routes lose digits nearx = 0. - The doubling identity.
T.DIST.2T(x, ν) = 2 · T.DIST.RT(x, ν)is exact in real arithmetic, and multiplication by two is exact in binary floating point. So if Excel computes the two surfaces from one internal quantity, the published bits must satisfy the identity exactly, and if they do not, the two surfaces have different internals. That is a rare situation: a metamorphic probe whose failure is as informative as its success, requiring no external oracle.
Errors
As documented on Microsoft's T.DIST.2T page:
| Error | Documented condition |
|---|---|
#VALUE! | Any argument is nonnumeric. |
#NUM! | deg_freedom < 1. |
#NUM! | x < 0. |
Errors in either argument propagate under the universal coercion rule. The Handbook has not verified any of this against Excel.
How to implement
Numerical notes
The two-tail area is the cleanest of the three t surfaces to compute, because in the beta
parameterization it is I_{ν/(ν+x²)}(ν/2, ½) with no prefactor and no complementation. An
implementation that computes it directly inherits the full relative accuracy of its incomplete
beta routine across the whole tail.
The traps are the ones the identity invites rather than the ones the formula contains:
- Do not compute it as
2 * (1 − T.DIST(x, ν, TRUE)). The inner subtraction destroys the tail before the doubling can restore anything. - Do not compute the central probability as
1 − T.DIST.2T(x, ν)for smallx. That is the same mistake mirrored, and it is the one a spreadsheet user is likelier to make, because Excel offers no surface for the central probability. - Argument reduction.
z = ν/(ν + x²)should be formed so that neitherx²overflows nor the small complementx²/(ν + x²)is lost. Keeping the complement and calling a complementary incomplete-beta entry point handles both.
For the continued-fraction evaluation of I_z(a, b) the standard reference is Numerical
Recipes' betacf, with the reflection applied so the fraction converges quickly; Cephes'
incbet and Boost.Math's ibeta/ibetac are the production treatments worth reading. For
integer ν, A&S 26.7.3–26.7.4 give finite closed forms, and A&S 26.7 also tabulates the
percentage points that a spreadsheet is standing in for.
Nothing here is a claim about Excel's algorithm. The Handbook does not know it.
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.
T.DIST.2T · 4 lines · calc-func/src/catalogue/distributions.rs on GitHub42 t_dist_2t "T.DIST.2T" (2, 2) [V "x", V "deg_freedom"] |s, a, sv| {
let [x, df] = nums::<2>(s, a)?;
out(s, cft::t_dist_2t_kernel(x, df))
}
Kernels shared with other functions
numscatalogue/distributionstruncate_positive_integerported/chi_f_t_familyvalidate_nonnegative_xported/chi_f_t_familyt_dist_2t_kernelported/chi_f_t_familybinary_withported/excel_numericexcel_x87_addported/excel_numericexcel_x87_mulported/excel_numericexcel_x87_mul_addported/excel_numericmulported/excel_numeric/x87addported/excel_numeric/x87bratio_ftoiported/special_math_commonbratio_spmpar1ported/special_math_commonbratio_expargported/special_math_commonbratio_esumported/special_math_commonbratio_esum20ported/special_math_commonbratio_alnrelported/special_math_commonbratio_rlog1ported/special_math_commonbratio_gam1ported/special_math_commonbratio_gamln1ported/special_math_commonbratio_gamlnported/special_math_commonbratio_algdivported/special_math_commonbratio_bcorrported/special_math_commonbratio_gsumlnported/special_math_commonbratio_betalnported/special_math_commonbratio_betaln_60ported/special_math_commonbratio_erf_nswcported/special_math_commonbratio_erfc1ported/special_math_commonbratio_rexpported/special_math_commonbratio_psiported/special_math_commonbratio_fpserported/special_math_commonbratio_apserported/special_math_commonbratio_bpserported/special_math_commonbratio_bupported/special_math_commonbratio_brcompported/special_math_commonbratio_brcmp1ported/special_math_commonbratio_bfracported/special_math_commonbratio_bgratported/special_math_commonbratio_grat1ported/special_math_commonbratio_basymported/special_math_commonbratioported/special_math_common
Argument and result plumbing
No implementation has been published with a Handbook test suite for this function.
Version differences
No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.
Alternatives
Relationships
TDIST(x, ν, 2)is the legacy spelling of this surface. Caution: the Handbook's alias-pairing record for the legacy/modern collapse namesTDISTandT.DIST.RTas one of its five pairs — that is the one-tail correspondence.T.DIST.2Tis not a subject of that record, and no evidence in the Handbook's record bears on whetherTDIST(x, ν, 2)andT.DIST.2T(x, ν)publish the same bits. They are documented to compute the same number; that is not the same statement.- T.DIST.RT — exactly half of this value for
x ≥ 0. - T.DIST — the left-tail CDF and the density.
- T.INV.2T is this function's inverse, and Microsoft's
T.INV.2Tpage says so explicitly: it seeks thexwithT.DIST.2T(x, ν) = probability, and states thatT.INV.2T's precision depends onT.DIST.2T's. T.INV invertsT.DISTinstead; confusing the two is the single most common error in this corner of Excel, because both are called "the inverse of the t-distribution" in ordinary speech. CHISQ.DIST.RTis the same shape of object for a different distribution, andERFCis the ν → ∞ limit up to thesqrt 2scaling.T.TESTwithtails = 2is the packaged consumer of this quantity.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents