{
  "category": "Compatibility",
  "display_name": "GAMMADIST",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.GAMMADIST",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20131",
        "?"
      ],
      "larger_numeric": 0,
      "last_bit": 2,
      "matched": 4,
      "other_mismatch": 0,
      "refused": 0,
      "rows": 6,
      "unread": 0,
      "worst_ulp": 3
    },
    "detail": "Everything else matches (6 in the answer bank and 6 workbook cells). Last-bit means a finite number within 16 ULP of Excel's.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "close",
    "state_label": "Close: last-bit deviations remain",
    "summary": "Close: 4 of 12 recorded answers differ in the last bits, worst 13 ULP",
    "workbook_corpus": {
      "cells": 6,
      "last_bit": 2,
      "matched": 4,
      "worst_ulp": 13
    }
  },
  "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#L227-L230"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/distributions::nums",
        "ported/beta_gamma_stats_family::validate_gamma_shape",
        "ported/beta_gamma_stats_family::gamma_dist_kernel",
        "ported/discrete_dist::finite",
        "ported/discrete_dist::expon_dist_kernel",
        "ported/excel_numeric::binary_with",
        "ported/excel_numeric::excel_expm1_internal",
        "ported/excel_numeric::excel_expm1_spilled",
        "ported/excel_numeric::expm1_internal_graph",
        "ported/excel_numeric::excel_x87_add",
        "ported/excel_numeric::excel_x87_sub",
        "ported/excel_numeric::excel_x87_mul",
        "ported/excel_numeric::excel_x87_temme_finish",
        "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",
        "ported/excel_numeric/x87_chains::pow2_positive",
        "ported/excel_numeric/x87_chains::pow2",
        "ported/excel_numeric/x87_chains::exp_ext",
        "ported/excel_numeric/x87_chains::exp_with",
        "ported/excel_numeric/x87_chains::excel_exp",
        "ported/excel_numeric/x87_chains::log_with",
        "ported/excel_numeric/x87_chains::excel_log",
        "ported/normal_dist_common::stored_horner",
        "ported/normal_dist_common::erf_approx",
        "ported/normal_dist_common::erfc_upper",
        "ported/special_dist_family::erf_precise_kernel",
        "ported/special_math_common::ln_gamma",
        "ported/special_math_common::gratio_norm_gamma",
        "ported/special_math_common::gratio_rexp",
        "ported/special_math_common::gratio_rlog",
        "ported/special_math_common::gratio_gam1",
        "ported/special_math_common::gratio",
        "ported/special_math_common::series_prefactor",
        "ported/special_math_common::gratio_after40",
        "ported/special_math_common::gratio_cf",
        "ported/special_math_common::gratio_temme_270",
        "ported/special_math_common::gratio_temme_340",
        "ported/special_math_common::gratio_temme_330",
        "ported/special_math_common::gratio_temme_finish",
        "ported/special_math_common::regularized_gamma_p"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/distributions.rs#L227-L230",
      "state": "close",
      "suite": null,
      "summary": "Close: 4 of 12 recorded answers differ in the last bits, worst 13 ULP"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.GAMMADIST.json",
  "name": "GAMMADIST",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n[GAMMA.DIST](FUNC.GAMMA.DIST.md) is the current spelling; [EXPON.DIST](FUNC.EXPON.DIST.md) handles the shape-one waiting time; [CHISQ.DIST](FUNC.CHISQ.DIST.md) is a shape/scale specialization.\n\n\n",
    "how-to-implement": "\nThe current shared CDF route first forms the binary64 scale ratio `y=x/beta`:\n\n1. At shape `alpha=0.5`, it calls the ERF.PRECISE body at the current binary64 `sqrt(y)`.\n2. At shape one, it calls the exponential CDF with arguments `(y,1)`. Computing `EXPON.DIST(x,1/beta,TRUE)` instead forms a different rounded ratio/product.\n3. Other shapes call the regularized lower gamma ratio `P(alpha,y)`.\n\nThe source retains modern-spelling composition controls for the first two branches, including non-dyadic scales. They do not identify every general-shape branch, and the shape-one **density** is not established by the CDF identity.\n\nFor positive `x` with shape other than one, the current density candidate forms stored `y=R(x/beta)` and `t=R(alpha*LN(y))`, then obtains an exponential prefix corresponding to `exp(t-y-logGamma(alpha+1))`. It finally multiplies that prefix by the separately stored ratio `R(alpha/x)`, with another stored multiplication. The outer ratio/product consumer has discriminating controls; the prefix producer and its return stage remain open. Shape one and zero input have separate fallback code.\n\nFor the example `x=2,alpha=1,beta=2`, `y=1`, so the mathematical CDF is `1-exp(-1)`, about `0.632120558828558`. That reduction explains the probability; substituting an integer-shape finite sum, a host gamma library or a reciprocal scale is another numerical candidate. The problem report retains general distribution mismatches, and no whole-function Handbook suite is published.\n\n\n",
    "quirks": "\nNegative `x` or nonpositive shape or scale gives `#NUM!`; nonnumeric numeric arguments give `#VALUE!`. A scale of two is not an exponential rate of two: for shape one it corresponds to rate one half.\n\nThe zero-input density needs a separate boundary decision. Mathematically its right-hand limit is zero for `alpha>1`, `1/beta` for `alpha=1`, and unbounded for `0<alpha<1`. The current density fallback evaluates a log expression at zero and can give `#NUM!`, including at shape one. Do not use a mathematical boundary value as an uncited claim about Excel’s actual return.\n\n\n",
    "sources": "\n- [Microsoft: GAMMADIST function](https://support.microsoft.com/en-us/excel/functions/gammadist-function), opened 6 November 2026; syntax, documented argument rules and errors.\n- [DnaCalc implementation](https://github.com/DnaCalc/DnaCalc/blob/da3ecc4fb19a3a5529708c311d0e8f05688ac165/crates/calc-func/src/ported/beta_gamma_stats_family.rs); implementation steps and the limits identified in the text.\n\n",
    "try-it": "\n`=GAMMADIST(2,1,2,TRUE)` is about `0.632120558828558`. With shape one it is an exponential waiting-time CDF with scale two.\n\n\n",
    "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.\n\n| Excel 16.0 build | Platform and CPU | Captured inputs |\n|---|---|---:|\n| 20131 | Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics | 6 |\n\nThe record contains no same-input comparison between these environments. Reading different inputs on different builds does not establish either a version change or cross-build agreement.\n\n[Recorded environments and comparison details](https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.GAMMADIST.json).",
    "what-it-does": "\n`GAMMADIST(x,alpha,beta,cumulative)` evaluates a gamma distribution with positive shape alpha and positive **scale** beta. TRUE returns the probability up to nonnegative `x`; FALSE returns a density. Beta has the same units as `x`. This is the compatibility spelling of GAMMA.DIST.\n\nShape one is the exponential waiting-time distribution with rate `1/beta`. Shapes `n/2` and scale two describe a chi-squared distribution with `n` degrees of freedom; these are mathematical relations, whose worksheet compositions can have different rounding histories.\n\n\n"
  },
  "signature": {
    "display": "GAMMADIST(x, alpha, beta, cumulative)",
    "parameters": [
      {
        "description": null,
        "name": "x",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "alpha",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "beta",
        "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": "None",
        "thread_safety_class": "SafePure",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": "Gamma distribution (older form of GAMMA.DIST)",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the gamma distribution",
        "microsoft_url": "https://support.microsoft.com/en-us/office/gammadist-function-7327c94d-0f05-4511-83df-1dd7ed23e19e"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "GAMMADIST"
        },
        {
          "locale": "bg-BG",
          "name": "GAMMADIST"
        },
        {
          "locale": "cs-CZ",
          "name": "GAMMADIST"
        },
        {
          "locale": "da-DK",
          "name": "GaMMAFORDELING"
        },
        {
          "locale": "de-DE",
          "name": "GAMMADIST"
        },
        {
          "locale": "el-GR",
          "name": "GAMMADIST"
        },
        {
          "locale": "en-AU",
          "name": "GAMMADIST"
        },
        {
          "locale": "en-GB",
          "name": "GAMMADIST"
        },
        {
          "locale": "en-US",
          "name": "GAMMADIST"
        },
        {
          "locale": "es-ES",
          "name": "DISTR.GAMMA"
        },
        {
          "locale": "et-EE",
          "name": "GAMMADIST"
        },
        {
          "locale": "fi-FI",
          "name": "GAMMAJAKAUMA"
        },
        {
          "locale": "fr-FR",
          "name": "LOI.GAMMA*"
        },
        {
          "locale": "he-IL",
          "name": "GAMMADIST"
        },
        {
          "locale": "hr-HR",
          "name": "GAMMADIST"
        },
        {
          "locale": "hu-HU",
          "name": "GAMMA.ELOSZLÁS"
        },
        {
          "locale": "id-ID",
          "name": "GAMMADIST"
        },
        {
          "locale": "it-IT",
          "name": "GAMMADIST"
        },
        {
          "locale": "ja-JP",
          "name": "GAMMADIST"
        },
        {
          "locale": "ko-KR",
          "name": "GAMMADIST"
        },
        {
          "locale": "lt-LT",
          "name": "GAMMADIST"
        },
        {
          "locale": "lv-LV",
          "name": "GAMMADIST"
        },
        {
          "locale": "nb-NO",
          "name": "GAMMADIST"
        },
        {
          "locale": "nl-NL",
          "name": "GAMMA.VERD"
        },
        {
          "locale": "pl-PL",
          "name": "ROZKŁAD.GAMMA"
        },
        {
          "locale": "pt-BR",
          "name": "GAMMADIST"
        },
        {
          "locale": "pt-PT",
          "name": "DISTGAMA"
        },
        {
          "locale": "ro-RO",
          "name": "GAMMADIST"
        },
        {
          "locale": "ru-RU",
          "name": "ГАММАРАСП"
        },
        {
          "locale": "sk-SK",
          "name": "GAMMADIST"
        },
        {
          "locale": "sl-SI",
          "name": "GAMMADIST"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "GAMMADIST"
        },
        {
          "locale": "sv-SE",
          "name": "GAMMAFÖRD"
        },
        {
          "locale": "th-TH",
          "name": "GAMMADIST"
        },
        {
          "locale": "tr-TR",
          "name": "GAMADAĞ işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "GAMMADIST"
        },
        {
          "locale": "vi-VN",
          "name": "GAMMADIST"
        },
        {
          "locale": "zh-CN",
          "name": "GAMMADIST"
        },
        {
          "locale": "zh-HK",
          "name": "GAMMADIST"
        },
        {
          "locale": "zh-TW",
          "name": "GAMMADIST"
        }
      ],
      "signature": {
        "display": "GAMMADIST(x, alpha, beta, cumulative)",
        "parameters": [
          {
            "description": null,
            "name": "x",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "alpha",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "beta",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "cumulative",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "GAMMADIST",
      "version_marker": null,
      "xlcall": {
        "code": "286",
        "symbol": "xlfGammadist"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/gammadist-function-7327c94d-0f05-4511-83df-1dd7ed23e19e"
  },
  "try_it": {
    "formula": "=GAMMADIST(2,1,2,TRUE)"
  },
  "url": "https://handbook.dnacalc.com/functions/GAMMADIST.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "6 captured inputs are indexed for this environment. Capture dates: 2026-07-16 to 2026-07-16. This is a reading count, not a comparison with another build.",
      "excel_build": "16.0 build 20131",
      "platform": "Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.GAMMADIST.json"
      ]
    }
  ]
}