{
  "category": "Math and trigonometry functions",
  "display_name": "SQRTPI",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.SQRTPI",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20430"
      ],
      "larger_numeric": 0,
      "last_bit": 0,
      "matched": 1224,
      "other_mismatch": 0,
      "refused": 0,
      "rows": 1224,
      "unread": 0,
      "worst_ulp": 0
    },
    "detail": "Recorded: 1,224 in the answer bank and 3 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 1,227 recorded answers",
    "workbook_corpus": {
      "cells": 3,
      "matched": 3
    }
  },
  "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/math.rs#L108-L111",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/sqrtpi.rs#L4-L25"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/math::unary"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/math.rs#L108-L111",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 1,227 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.SQRTPI.json",
  "name": "SQRTPI",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n### Relationships\n\n\n- **`SQRT`** — the underlying operation, and the function `SQRTPI` is *not* implemented on top\n  of, according to the evidence attached to this page. That is the whole story of this surface.\n- **`PI`** — the constant. `SQRTPI(n)` and `SQRT(n * PI())` are the same mathematical value and\n  are not guaranteed to be the same double, because they take different routes.\n- **`POWER` and the `^` operator** — the general power routine, which is what the evidence\n  records identify as the substrate here.\n- **`GAMMA`** — `SQRTPI(1)` is `GAMMA(0.5)`, exactly. That identity is a free cross-check\n  between two unrelated implementations in the same workbook.\n- **`NORM.DIST`, `NORM.S.DIST`, `ERF`** — the consumers. Every one of them carries a\n  `sqrt(pi)`-family constant internally, which is why this function exists.\n- **Confused with**: `SQRT(PI() * number)` written by hand, which is the same thing and may not\n  produce the same bits; and with `PI()` alone.\n\n\n",
    "how-to-implement": "\n### Numerical notes\n\n\n**The finding on this surface is about the routine, not the mathematics.** Both evidence records\nattached to this page make the same point from different angles: the square root here is\nperformed by a general power routine — `(n*pi)^0.5` — rather than by a dedicated square root.\n\nThat distinction is not pedantry. IEEE 754 requires `squareRoot` to be correctly rounded; it\nrequires nothing of the sort from `pow`. A correctly rounded `sqrt` returns the true value\nrounded once; a general `pow` typically computes `exp(0.5 * log(x))` with extended-precision\nbookkeeping and lands on the correctly rounded value almost always, but not always. The two\ntherefore agree at ordinary magnitudes and can part company near the extremes of the exponent\nrange. `EV-MISC-0014` records the witness: at the input where `n*pi` reaches the largest finite\ndouble, the correctly rounded square root and the power routine give different results, and\n**the record's reading is that the power routine is the less accurate party while the reference\nengine reproduces it deliberately.** `EV-MISC-0014` also rules out x87 extended precision as the\ncause — both sides of that comparison are SSE2 — so this is a routine-choice effect, not a\nregister-width effect.\n\nBoth records carry a reader warning about attribution, and the warning is the interesting part\nof the epistemology: the count that exists in the upstream source has a power routine as its\ngrammatical subject, not `SQRTPI` worksheet calls, and neither record is willing to republish it\nas a pass rate for this function. **This page states none of those figures; the evidence layer\nrenders them beside it with their warnings attached.**\n\n**What a careful implementation does.** Three things, in order of importance:\n\n1. **Use `sqrt`, not `pow`,** if the goal is the mathematically best answer. This costs nothing\n   and buys correct rounding of the root. It is also, per the records above, precisely the choice\n   that would *disagree* with Excel at the extremes — which is the four-flavour distinction this\n   Handbook exists to make explicit: an Excel-compatibility implementation and a\n   mathematically-correct implementation genuinely differ here, and both are right about\n   different questions.\n2. **Guard the intermediate.** `n * pi` is one multiplication and one rounding; the product both\n   overflows for large `n` and loses a rounding step that the true `sqrt(n*pi)` does not have.\n   Scaling `n` down by a power of four and the result up by the matching power of two removes\n   the overflow band exactly, because powers of four are exact under square root.\n3. **Consider the two roundings.** Even ignoring `pow`, `SQRTPI` rounds twice — once forming\n   `n*pi`, once taking the root. A correctly rounded `SQRTPI` would need the product in higher\n   precision (a two-product/`fma` split is enough) before rooting. No implementation is obliged\n   to do this, and the Handbook is not claiming any does; it is the difference between \"the\n   square root of the rounded product\" and \"the rounded square root of the product\", and those\n   are different functions in the last bit.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nReturns `Number`.\n\n- **Zero** gives zero.\n- **Negative** gives `#NUM!`, as documented.\n- **Very large arguments.** This is where the function stops being boring. `number * pi`\n  overflows binary64 for arguments above roughly the top of the range divided by `pi`, and the\n  overflow happens in the *intermediate product*, before the root is taken — even though\n  `sqrt(number * pi)` would be an entirely ordinary number if computed with any headroom. A\n  two-step implementation therefore has a band of arguments it cannot answer that the\n  mathematical function has no trouble with. The remedy is standard and cheap: scale by a power\n  of four before the multiplication and by the corresponding power of two after the root.\n  Whether Excel does this is unverified.\n\n1. **The documented `#NUM!` for negative arguments is not expressed by the declared axis.**\n   `arg_domain_guard=none` says there is no argument-domain guard; Microsoft documents one. The\n   likely reading is that the check lives inside the `Custom` kernel rather than in the axis\n   vocabulary, making this a classification gap rather than a behavioural claim — but the\n   Handbook records the mismatch, because a reader consulting the axis alone would conclude the\n   function is total on the reals.\n2. **`non_finite=allow` would permit publishing an infinity.** For an argument large enough that\n   `number * pi` overflows, a naive two-step evaluation produces an infinite intermediate and an\n   infinite root, and `non_finite=allow` does not reject it. That sits in tension with the\n   Handbook's evidence record `EV-MATH-0008`, whose finding — for a different set of surfaces,\n   not including `SQRTPI` — is that Excel never publishes an infinity and maps non-finite real\n   results to `#NUM!`. Whether `SQRTPI` is an exception to that convention, or whether the axis\n   value is simply not load-bearing here, is an open question and the sharpest probe on this\n   page.\n\n\n### Errors\n\n\n| Error | Condition | Source |\n|---|---|---|\n| `#NUM!` | `number < 0` | Documented by Microsoft |\n| `#VALUE!` | The argument does not convert to a number | Shared coercion rules |\n| propagated | An error value in the argument is returned unchanged | Shared coercion rules |\n\nWhat happens at the overflow boundary is not documented and is not settled by the reference\nengine's declared axes; see above.\n\n\n",
    "sources": "\n- Microsoft, \"SQRTPI function\" —\n  <https://support.microsoft.com/en-us/office/sqrtpi-function-1fb4e63f-9b51-46d6-ad68-b3e7a8b519b4>\n  (signature, the definition `sqrt(number * pi)`, and \"If number < 0, SQRTPI returns the #NUM!\n  error value\").\n- Handbook evidence records `EV-MATH-0011` and `EV-MISC-0014` (subjects include `FUNC.SQRTPI`)\n  — the identification of a power routine rather than a dedicated square root, with their own\n  attribution warnings. `EV-STRUCT-0009` includes `FUNC.SQRTPI` only in a group-scope membership\n  and is therefore not claimed for this surface.\n- Handbook evidence record `EV-MATH-0008` — the non-finite publication convention for a\n  different set of surfaces, cited here only for the tension it creates with this surface's\n  `non_finite=allow` axis.\n- IEEE 754-2019 clause 5.4.1 — `squareRoot` is a correctly rounded operation; `pow` is not.\n- Abramowitz & Stegun, *Handbook of Mathematical Functions*, 6.1.8 and 7.1.1 — `Gamma(1/2) =\n  sqrt(pi)` and the error function's normalizing constant.\n- Handbook projections `data/functions/FUNC.SQRTPI.json` (arity,\n  `kernel_signature_class: Custom`, `real_result_policy` with `arg_domain_guard=none` and\n  `non_finite=allow`) and `data/presence/FUNC.SQRTPI.json`.\n- Handbook [SQRT](FUNC.SQRT.md) and\n  [Coercion and lifting](../model/02-coercion-and-lifting.md).\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| 19929 | Windows, bitness not recorded, CPU not recorded | 44 |\n| 20430 | Windows, 64-bit, CPU not recorded | 1,224 |\n\n- XC-SQRTPI-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.\n\nAgreement on these compared inputs does not establish agreement on unmeasured inputs.\n\n[Recorded environments and comparison details](https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.SQRTPI.json).",
    "what-it-does": "\n`SQRTPI(number)` returns\n\n    sqrt(number * pi)\n\n- **Domain**: `[0, +infinity)`. Microsoft's page states: \"If number < 0, SQRTPI returns the\n  #NUM! error value.\"\n- **Range**: `[0, +infinity)`, with `SQRTPI(0) = 0` and `SQRTPI(1) = sqrt(pi)`.\n- **Shape**: a scaling of `SQRT` by `sqrt(pi)`, so it inherits every structural property of the\n  square root — strictly increasing, concave, principal branch, relative condition number\n  exactly `1/2`, branch point at the origin.\n\n**Why the constant is `pi` and not something else.** `sqrt(pi)` is not an arbitrary convenience.\nIt is `Gamma(1/2)` (A&S 6.1.8), and it is the normalizing constant of the Gaussian: the error\nfunction is defined as `erf(x) = (2/sqrt(pi)) * integral from 0 to x of e^(-t^2) dt` (A&S\n7.1.1), and the normal density carries `1/sqrt(2 pi)`. Expressions of the form\n`sqrt(2 pi sigma^2)` and `sqrt(n pi)` (Stirling's approximation:\n`n! ~ sqrt(2 pi n) (n/e)^n`) occur constantly in statistics and in asymptotic analysis. `SQRTPI`\nexists so that a worksheet can write one call instead of `SQRT(n * PI())`.\n\nThat is the whole of the mathematics. The function is a composition of a multiplication and a\nsquare root, and everything interesting about it is *which* square root.\n\n\n\n### Arguments\n\n\n| Argument | Meaning | Default |\n|---|---|---|\n| `number` | The number by which pi is multiplied. Required, must be non-negative. | — |\n\nThe commonly misunderstood position: `number` is the *argument of the multiplication*, not of\nthe root. `SQRTPI(2)` is `sqrt(2 pi)`, not `2 sqrt(pi)`. Readers who want `2 sqrt(pi)` want\n`SQRTPI(4)`.\n\n\n"
  },
  "signature": {
    "display": "SQRTPI(number)",
    "parameters": [
      {
        "description": null,
        "name": "number",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 1,
        "min": 1
      },
      "category": "Math and trigonometry functions",
      "classification": {
        "arg_preparation_profile": "ValuesOnlyPreAdapter",
        "coercion_lift_profile": "UnaryNumericScalarOrArrayElementwise",
        "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": "Square root of a number times pi",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the square root of (number * pi)",
        "microsoft_url": "https://support.microsoft.com/en-us/office/sqrtpi-function-1fb4e63f-9b51-46d6-ad68-b3e7a8b519b4"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "SQRTPI"
        },
        {
          "locale": "bg-BG",
          "name": "SQRTPI"
        },
        {
          "locale": "cs-CZ",
          "name": "SQRTPI"
        },
        {
          "locale": "da-DK",
          "name": "KVRODPI"
        },
        {
          "locale": "de-DE",
          "name": "SQRTPI"
        },
        {
          "locale": "el-GR",
          "name": "SQRTPI"
        },
        {
          "locale": "en-AU",
          "name": "SQRTPI"
        },
        {
          "locale": "en-GB",
          "name": "SQRTPI"
        },
        {
          "locale": "en-US",
          "name": "SQRTPI"
        },
        {
          "locale": "es-ES",
          "name": "RAIZ2PI"
        },
        {
          "locale": "et-EE",
          "name": "SQRTPI"
        },
        {
          "locale": "fi-FI",
          "name": "NELIÖJUURI.PII"
        },
        {
          "locale": "fr-FR",
          "name": "RACINE.PI*"
        },
        {
          "locale": "he-IL",
          "name": "SQRTPI"
        },
        {
          "locale": "hr-HR",
          "name": "SQRTPI"
        },
        {
          "locale": "hu-HU",
          "name": "GYÖKPI"
        },
        {
          "locale": "id-ID",
          "name": "SQRTPI"
        },
        {
          "locale": "it-IT",
          "name": "SQRTPI"
        },
        {
          "locale": "ja-JP",
          "name": "SQRTPI"
        },
        {
          "locale": "ko-KR",
          "name": "SQRTPI"
        },
        {
          "locale": "lt-LT",
          "name": "SQRTPI"
        },
        {
          "locale": "lv-LV",
          "name": "SQRTPI"
        },
        {
          "locale": "nb-NO",
          "name": "SQRTPI"
        },
        {
          "locale": "nl-NL",
          "name": "WORTEL.PI"
        },
        {
          "locale": "pl-PL",
          "name": "PIERW.PI"
        },
        {
          "locale": "pt-BR",
          "name": "SQRTPI"
        },
        {
          "locale": "pt-PT",
          "name": "RAIZPI"
        },
        {
          "locale": "ro-RO",
          "name": "SQRTPI"
        },
        {
          "locale": "ru-RU",
          "name": "КОРЕНЬПИ"
        },
        {
          "locale": "sk-SK",
          "name": "SQRTPI"
        },
        {
          "locale": "sl-SI",
          "name": "SQRTPI"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "SQRTPI"
        },
        {
          "locale": "sv-SE",
          "name": "ROTPI"
        },
        {
          "locale": "th-TH",
          "name": "SQRTPI"
        },
        {
          "locale": "tr-TR",
          "name": "KAREKÖKPİ işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "SQRTPI"
        },
        {
          "locale": "vi-VN",
          "name": "SQRTPI"
        },
        {
          "locale": "zh-CN",
          "name": "SQRTPI"
        },
        {
          "locale": "zh-HK",
          "name": "SQRTPI"
        },
        {
          "locale": "zh-TW",
          "name": "SQRTPI"
        }
      ],
      "signature": {
        "display": "SQRTPI(number)",
        "parameters": [
          {
            "description": null,
            "name": "number",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "SQRTPI",
      "version_marker": null,
      "xlcall": {
        "code": "416",
        "symbol": "xlfSqrtpi"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/sqrtpi-function-1fb4e63f-9b51-46d6-ad68-b3e7a8b519b4"
  },
  "try_it": {
    "formula": "=SQRTPI(2)"
  },
  "url": "https://handbook.dnacalc.com/functions/SQRTPI.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "44 captured inputs are indexed for this environment. Capture dates are not recorded. This is a reading count, not a comparison with another build.",
      "excel_build": "16.0 build 19929",
      "platform": "Windows, bitness not recorded, CPU not recorded",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.SQRTPI.json"
      ]
    },
    {
      "behaviour": "1,224 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.",
      "excel_build": "16.0 build 20430",
      "platform": "Windows, 64-bit, CPU not recorded",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.SQRTPI.json"
      ]
    }
  ]
}