{
  "category": "Compatibility",
  "display_name": "BINOMDIST",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.BINOMDIST",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Recorded: 6 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 6 recorded answers",
    "workbook_corpus": {
      "cells": 6,
      "matched": 6
    }
  },
  "implementations": [
    {
      "commit": "9e1884369a678158dd82d3d74188daf986995e87",
      "flavour": "excel-compatibility-candidate",
      "language": "Rust",
      "name": "CalcFunc",
      "own_code": [
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/distributions.rs#L265-L268"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/distributions::nums",
        "ported/discrete_dist::stirling_error",
        "ported/discrete_dist::deviance",
        "ported/discrete_dist::binom_mass",
        "ported/discrete_dist::finite",
        "ported/discrete_dist::binom_dist_kernel",
        "ported/excel_numeric::binary_with",
        "ported/excel_numeric::excel_x87_add",
        "ported/excel_numeric::excel_x87_sub",
        "ported/excel_numeric::excel_x87_mul",
        "ported/excel_numeric::excel_x87_div",
        "ported/excel_numeric/x87::mul",
        "ported/excel_numeric/x87::add",
        "ported/excel_numeric/x87::sub",
        "ported/excel_numeric/x87::div"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/distributions.rs#L265-L268",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 6 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.BINOMDIST.json",
  "name": "BINOMDIST",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n[BINOM.INV](FUNC.BINOM.INV.md) finds a success-count quantile; [BINOM.DIST.RANGE](FUNC.BINOM.DIST.RANGE.md) covers an interval of counts; [HYPGEOM.DIST](FUNC.HYPGEOM.DIST.md) models sampling without replacement.\n\n\n",
    "how-to-implement": "\nAfter truncating successes `k` and trials `n` toward zero, validate `0<=k<=n` and `0<=p<=1`. The current recorded domain rejects `n>=2147483647` before selecting endpoint shortcuts. At `p=0` or `p=1`, handle the degenerate distribution explicitly; the recorded noncumulative `p=1,k=0,n>0` case gives `#NUM!`, a compatibility exception to the mathematical zero.\n\nFor the **all-success, noncumulative** route `k=n>0`, `0<p<1`:\n\n1. Obtain the stored measured public [LN](FUNC.LN.md#how-to-implement) result for p, called `L`.\n2. Compute `t=R(n*L)` with the [stored-arithmetic recipe](../model/09-staged-arithmetic.md), rounding once to a 64-bit significand and then storing to binary64.\n3. Pass the stored `t` to the measured public [EXP route](FUNC.EXP.md#how-to-implement) and publish its result under the function’s finite/subnormal policy.\n\nWorked `n=3,p=0.5`: `L` is about `-0.6931471805599453`, the stored product is about `-2.0794415416798357`, and this reconstruction’s exponential is `0.12500000000000003`, near the mathematical probability `0.125`. The stored intermediate values explain why the computation need not return the exactly representable mathematical result. A direct `pow(p,n)` has different intermediate stages and is not a substitute for this identified computation tree.\n\nThe all-success stored product is distinguished by 300 numeric discriminants and 256 controls in the cited code. Its scope does not cover the zero-success producer, interior masses or every separately recorded domain answer.\n\nThe later R31 source isolates additional **interior-mass stages**. These start from Loader’s published saddle-point form, then preserve separately measured arithmetic sites. Let `D` mean ordinary binary64 storage and `E` resident 64-bit-significand arithmetic; their [portable definitions](../model/09-staged-arithmetic.md#retain-an-extended-intermediate-when-the-recipe-requires-it) keep E distinct from R.\n\n1. For `0<k<n`, set `q=D(1-p)`. Obtain Stirling correction s and deviance d from the explicit [Poisson helper recipes](FUNC.POISSON.DIST.md#how-to-implement).\n2. Form `c=R(s(n)-s(k))`, then successively `c=R(c-d(k,R(n*p)))`, `c=R(c-s(n-k))` and `c=R(c-d(n-k,R(n*q)))`. Keep this subtraction order. The source records 13,000 controls across six `(n,k)` pairs for that exponent grid.\n3. Form the ordered binary64 terms `[-LN(n)/2,LN(k)/2,LN(n-k)/2,0.9189385332046728]`. Their mathematical effect supplies `sqrt(n/(2*pi*k*(n-k)))` without directly forming that ratio.\n4. Initialize stored a and resident b from c. For each term, update `a=R(a-term)` and separately `b=E(b-term)`, retaining b across the whole list. Compute `lost=D(E(b-a))`, `factor=R(1+lost)`, and return `R(EXP(a)*factor)`.\n\nBINOM uses one correction for the running resident difference. POISSON’s prefactor instead keeps one correction factor for each of its two subtractions. They are distinct reconstructions even though both compensate a stored exponent.\n\nFor `k=3,n=10,p=0.25`, the stated interior reconstruction gives `0.2502822875976563`. Direct exact rational evaluation of `120*(1/4)^3*(3/4)^7` gives the representable mathematical value `0.25028228759765625`. The first number is a worked reconstruction, rather than a new Excel reading or a statement that the candidate is correct on that input.\n\nThe current cumulative route sums masses forward with ordinary binary64 additions and caps the final sum at one; it has its own endpoint shortcuts. A stable recurrence or incomplete-beta CDF is another mathematical algorithm with a different rounding history. The source’s zero-success logarithm remains unidentified, the Stirling table and deviance retain exceptions, and the problem report still records unresolved distribution answers. These stages do not establish whole-function agreement; the separately pinned interactive calculator can also predate the later interior update.\n\n\n",
    "quirks": "\nCounts are truncated toward zero. A probability outside zero to one, or an out-of-range success count, gives `#NUM!`; nonnumeric numeric arguments give `#VALUE!`. “At least k” uses a complement at `k-1`, not at k. The all-success mass and its cumulative endpoint follow different paths.\n\n\n",
    "sources": "\n- [Microsoft: BINOMDIST function](https://support.microsoft.com/en-us/excel/functions/binomdist-function), opened 6 November 2026; syntax, documented argument rules and errors.\n- [DnaCalc implementation](https://github.com/DnaCalc/DnaCalc/blob/481f4ab85d3bf5a95b6daf959bb75ccb2f8b40f8/crates/calc-func/src/ported/discrete_dist.rs); implementation steps and the limits identified in the text.\n- [Remaining numerical failures](https://github.com/DnaCalc/DnaCalc/blob/481f4ab85d3bf5a95b6daf959bb75ccb2f8b40f8/docs/generated/problem-functions.md).\n- [R31 running exponential correction](https://github.com/DnaCalc/DnaCalc/blob/481f4ab85d3bf5a95b6daf959bb75ccb2f8b40f8/crates/calc-func/src/ported/excel_numeric/x87_chains.rs); `exp_running`, with resident and stored subtraction chains.\n- [Loader’s published saddle-point method](https://www.r-project.org/doc/reports/CLoader-dbinom-2002.pdf), opened 6 November 2026; mathematical starting form, separate from the measured store identification.\n\n",
    "try-it": "\n`=BINOMDIST(3,3,0.5,FALSE)` is about `0.125`. `=BINOMDIST(3,3,0.5,TRUE)` returns `1`, since all possible outcomes have at most three successes.\n\n\n",
    "version-differences": "\nNo same-input comparison between named Excel builds is recorded for this function here. The documented behaviour below is not a measurement of every Excel release.\n\n\n",
    "what-it-does": "\n`BINOMDIST(number_s, trials, probability_s, cumulative)` describes successes in a fixed number of independent trials with one success probability. FALSE returns exactly that many successes; TRUE returns at most that many. BINOMDIST is the compatibility name; BINOM.DIST makes the distribution role explicit.\n\n\n"
  },
  "signature": {
    "display": "BINOMDIST(number_s, trials, probability_s, cumulative)",
    "parameters": [
      {
        "description": null,
        "name": "number_s",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "trials",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "probability_s",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "cumulative",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 4,
        "min": 4
      },
      "category": "Compatibility",
      "classification": {
        "arg_preparation_profile": "ValuesOnlyPreAdapter",
        "coercion_lift_profile": "Custom",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "None",
        "host_interaction_class": "None",
        "kernel_signature_class": "Custom",
        "rich_value_usage": "RichBlind",
        "surface_fec_dependency_profile": "RefOnly",
        "thread_safety_class": "SafePure",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": "Binomial probability (the older form of BINOM.DIST)",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the individual term binomial distribution probability",
        "microsoft_url": "https://support.microsoft.com/en-us/office/binomdist-function-506a663e-c4ca-428d-b9a8-05583d68789c"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "BINOMDIST"
        },
        {
          "locale": "bg-BG",
          "name": "BINOMDIST"
        },
        {
          "locale": "cs-CZ",
          "name": "BINOMDIST"
        },
        {
          "locale": "da-DK",
          "name": "BINOMIALFORDELING"
        },
        {
          "locale": "de-DE",
          "name": "BINOMDIST"
        },
        {
          "locale": "el-GR",
          "name": "BINOMDIST"
        },
        {
          "locale": "en-AU",
          "name": "BINOMDIST"
        },
        {
          "locale": "en-GB",
          "name": "BINOMDIST"
        },
        {
          "locale": "en-US",
          "name": "BINOMDIST"
        },
        {
          "locale": "es-ES",
          "name": "DISTR.BINOM"
        },
        {
          "locale": "et-EE",
          "name": "BINOMDIST"
        },
        {
          "locale": "fi-FI",
          "name": "BINOMIJAKAUMA"
        },
        {
          "locale": "fr-FR",
          "name": "LOI.BINOMIALE*"
        },
        {
          "locale": "he-IL",
          "name": "BINOMDIST"
        },
        {
          "locale": "hr-HR",
          "name": "BINOMDIST"
        },
        {
          "locale": "hu-HU",
          "name": "BINOM.ELOSZLÁS"
        },
        {
          "locale": "id-ID",
          "name": "BINOMDIST"
        },
        {
          "locale": "it-IT",
          "name": "BINOMDIST"
        },
        {
          "locale": "ja-JP",
          "name": "BINOMDIST"
        },
        {
          "locale": "ko-KR",
          "name": "BINOMDIST"
        },
        {
          "locale": "lt-LT",
          "name": "BINOMDIST"
        },
        {
          "locale": "lv-LV",
          "name": "BINOMDIST"
        },
        {
          "locale": "nb-NO",
          "name": "BINOMDIST"
        },
        {
          "locale": "nl-NL",
          "name": "BINOMDIST"
        },
        {
          "locale": "pl-PL",
          "name": "ROZKŁAD.DWUM"
        },
        {
          "locale": "pt-BR",
          "name": "BINOMDIST"
        },
        {
          "locale": "pt-PT",
          "name": "DISTRBINOM"
        },
        {
          "locale": "ro-RO",
          "name": "BINOMDIST"
        },
        {
          "locale": "ru-RU",
          "name": "БИНОМРАСП"
        },
        {
          "locale": "sk-SK",
          "name": "BINOMDIST"
        },
        {
          "locale": "sl-SI",
          "name": "BINOMDIST"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "BINOMDIST"
        },
        {
          "locale": "sv-SE",
          "name": "BINOMFÖRD"
        },
        {
          "locale": "th-TH",
          "name": "BINOMDIST"
        },
        {
          "locale": "tr-TR",
          "name": "BİNOMDAĞ işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "BINOMDIST"
        },
        {
          "locale": "vi-VN",
          "name": "BINOMDIST"
        },
        {
          "locale": "zh-CN",
          "name": "BINOMDIST"
        },
        {
          "locale": "zh-HK",
          "name": "BINOMDIST"
        },
        {
          "locale": "zh-TW",
          "name": "BINOMDIST"
        }
      ],
      "signature": {
        "display": "BINOMDIST(number_s, trials, probability_s, cumulative)",
        "parameters": [
          {
            "description": null,
            "name": "number_s",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "trials",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "probability_s",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "cumulative",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "BINOMDIST",
      "version_marker": null,
      "xlcall": {
        "code": "273",
        "symbol": "xlfBinomdist"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/binomdist-function-506a663e-c4ca-428d-b9a8-05583d68789c"
  },
  "try_it": {
    "formula": "=BINOMDIST(3,3,0.5,FALSE)"
  },
  "url": "https://handbook.dnacalc.com/functions/BINOMDIST.html",
  "variants": [],
  "versions": []
}