{
  "category": "Math and trigonometry functions",
  "display_name": "QUOTIENT",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.QUOTIENT",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20430"
      ],
      "larger_numeric": 0,
      "last_bit": 0,
      "matched": 1350,
      "other_mismatch": 0,
      "refused": 12,
      "rows": 1362,
      "unread": 0,
      "worst_ulp": 0
    },
    "detail": "Of 1,522 recorded answers (1,362 in the answer bank and 160 workbook cells), 12 do not match: 12 are refused.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "differs",
    "state_label": "Known larger differences",
    "summary": "Refuses 12 of 1,522 recorded calls; the rest match",
    "workbook_corpus": {
      "cells": 160,
      "matched": 160
    }
  },
  "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/rounding.rs#L115-L115"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/rounding::call",
        "catalogue/rounding::numeric",
        "catalogue/rounding::numbers",
        "catalogue/rounding::quotient",
        "decimal::truncate"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/rounding.rs#L115-L115",
      "state": "differs",
      "suite": null,
      "summary": "Refuses 12 of 1,522 recorded calls; the rest match"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.QUOTIENT.json",
  "name": "QUOTIENT",
  "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- **`MOD` — and this is the important one.** In most languages `div` and `mod` are a matched pair\n  satisfying `n = d·div(n,d) + mod(n,d)`. **In Excel they are not a pair.** `QUOTIENT` truncates\n  toward zero; Excel's `MOD` is documented to take the sign of the divisor, which is the *floored*\n  convention. With `n = -7`, `d = 3`: `QUOTIENT` gives `-2`, `MOD` gives `2`, and\n  `3·(-2) + 2 = -4 ≠ -7`. The identity fails on every input where the operands have opposite\n  signs. Boute's TOPLAS paper is the standard taxonomy of exactly this mismatch; Excel is one of\n  the systems it was written about. The matching partner of Excel's `MOD` is `INT(n/d)`, not\n  `QUOTIENT(n,d)`.\n- **`INT`** — `INT` floors, `TRUNC` truncates, and `QUOTIENT` truncates a quotient. For positive\n  operands all three agree, which is why the difference is usually discovered in production.\n- **`TRUNC`** — `QUOTIENT(n,d)` and `TRUNC(n/d)` are the same computation, with one difference\n  that matters: `n/d` written as an expression yields `#DIV/0!` on a zero divisor from the\n  operator, whereas `QUOTIENT` yields it from the function. There is no accuracy difference; both\n  form the quotient in binary64 first.\n\n\n",
    "how-to-implement": "\n### Numerical notes\n\n\n`QUOTIENT` looks arithmetic-free and is not.\n\n**The division rounds before the truncation.** `n/d` is computed in binary64 and rounded to\nnearest; only then is the fractional part discarded. When the exact quotient sits just below an\ninteger, the rounding can carry it up to that integer, and truncation then returns a value one\nlarger than the true integer part. This is not hypothetical: it is the standard failure mode of\nevery `trunc(a/b)` integer division in floating point, and it is why languages with exact integer\ntypes do not implement `div` this way. The magnitude of the exact quotient does not have to be\nlarge — it only has to be within half an ulp of an integer, which happens for perfectly ordinary\ndecimal inputs whose binary representations are inexact.\n\n**The remedy, for an implementation that wants the true integer part**, is to compute the\ncandidate `q = trunc(fl(n/d))` and then correct it using an exactly computed residual: the\nproduct `d·q` is exact whenever `q` is small enough, and `fma(-d, q, n)` gives the residual\nwithout rounding error, so the sign of the residual says whether `q` overshot. Two corrections\nsuffice. This is the same technique used to make `fmod` exact, and it is cheap.\n\n**Above 2⁵³ the question changes character.** There, the quotient's binary64 representation has no\nfractional bits at all, so \"the integer part\" is a property of the *rounded* quotient rather than\nof the exact one, and no post-correction recovers what was lost in the operands. An implementation\nshould decide whether it is computing `trunc` of the *real* quotient or of the *floating-point*\nquotient, and say which. The two are different functions.\n\n**Exactness where it does hold.** When `d` is a power of two, or when `n` and `d` are both exact\nintegers below 2⁵³, `n/d` is either exact or has a well-behaved error and the naive route is\ncorrect. The overwhelming majority of spreadsheet uses live in that region, which is why the\nhazard above is rarely seen and, when seen, is disbelieved.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nReturns `Number`, always an integral value (or an error).\n\n- **Signs.** All four sign combinations truncate toward zero: `QUOTIENT(7,3)` and\n  `QUOTIENT(-7,-3)` are `2`; `QUOTIENT(-7,3)` and `QUOTIENT(7,-3)` are `-2`.\n- **Non-integer arguments** are accepted and are not pre-rounded: `QUOTIENT(7.9, 2)` is `3`,\n  because `7.9/2 = 3.95` truncates to `3`.\n\n\n",
    "sources": "- Microsoft, \"WorksheetFunction.Quotient method (Excel)\" —\n  <https://learn.microsoft.com/en-us/office/vba/api/excel.worksheetfunction.quotient> (the\n  \"integer portion of a division\" description and the single `#VALUE!` condition; no zero-divisor\n  case is stated).\n- Boute, \"The Euclidean definition of the functions div and mod\", ACM TOPLAS 14(2), 1992 — the\n  truncated/floored/Euclidean taxonomy.\n- Handbook evidence record `EV-STRUCT-0007`, rendered beside this page with its own reader\n  warning.\n- Handbook, [Coercion and lifting](../model/02-coercion-and-lifting.md).\n- Handbook projections `data/functions/FUNC.QUOTIENT.json` (`UnaryNumericScalarOnly`,\n  `arg_domain_guard=none`) and `data/presence/FUNC.QUOTIENT.json` (own module; defect stream\n  `BUG-FUNC-028`).\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 | 93 |\n| 20430 | Windows, 64-bit, CPU not recorded | 3,119 |\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.QUOTIENT.json).",
    "what-it-does": "\n`QUOTIENT(numerator, denominator)` returns the integer part of `numerator / denominator`,\ndiscarding the remainder.\n\n    QUOTIENT(n, d) = trunc(n / d)\n\n**Truncation, not floor.** `trunc` rounds toward zero, so the sign of the numerator survives:\n`trunc(-7/3) = -2`, whereas `⌊-7/3⌋ = -3`. This single choice is the whole content of the\nfunction, and it is the source of the trap in the next section.\n\nDomain: all real `n`, and `d ≠ 0`. Range: the integers representable as binary64 — which is to\nsay, exact integers up to 2⁵³ and even integers thereafter.\n\n\n\n### Arguments\n\n\n| Argument | Meaning | Default |\n|---|---|---|\n| `numerator` | The dividend. Required. | — |\n| `denominator` | The divisor. Required. | — |\n\nBoth are ordinary numeric slots — see\n[Coercion and lifting](../model/02-coercion-and-lifting.md). Microsoft's VBA page names both as\n`Variant`, which is consistent with text and logicals converting; the same page states the single\ndocumented error condition, quoted under *Errors* below.\n\nNothing in the documentation requires either argument to be an integer, and neither is truncated\nbefore the division: the truncation happens once, to the quotient.\n\n\n"
  },
  "signature": {
    "display": "QUOTIENT(numerator, denominator)",
    "parameters": [
      {
        "description": null,
        "name": "numerator",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "denominator",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 2,
        "min": 2
      },
      "category": "Math and trigonometry functions",
      "classification": {
        "arg_preparation_profile": "ValuesOnlyPreAdapter",
        "coercion_lift_profile": "UnaryNumericScalarOnly",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "None",
        "host_interaction_class": "None",
        "kernel_signature_class": "NumsToNum",
        "rich_value_usage": "RichBlind",
        "surface_fec_dependency_profile": "RefOnly",
        "thread_safety_class": "SafePure",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": "Whole-number part of a division",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the integer portion of a division",
        "microsoft_url": "https://support.microsoft.com/en-us/office/quotient-function-9f7bf099-2a18-4282-8fa4-65290cc99dee"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "QUOTIENT"
        },
        {
          "locale": "bg-BG",
          "name": "QUOTIENT"
        },
        {
          "locale": "cs-CZ",
          "name": "QUOTIENT"
        },
        {
          "locale": "da-DK",
          "name": "KVOTIENT"
        },
        {
          "locale": "de-DE",
          "name": "QUOTIENT"
        },
        {
          "locale": "el-GR",
          "name": "QUOTIENT"
        },
        {
          "locale": "en-AU",
          "name": "QUOTIENT"
        },
        {
          "locale": "en-GB",
          "name": "QUOTIENT"
        },
        {
          "locale": "en-US",
          "name": "QUOTIENT"
        },
        {
          "locale": "es-ES",
          "name": "COCIENTE"
        },
        {
          "locale": "et-EE",
          "name": "QUOTIENT"
        },
        {
          "locale": "fi-FI",
          "name": "OSAMÄÄRÄ"
        },
        {
          "locale": "fr-FR",
          "name": "QUOTIENT*"
        },
        {
          "locale": "he-IL",
          "name": "QUOTIENT"
        },
        {
          "locale": "hr-HR",
          "name": "QUOTIENT"
        },
        {
          "locale": "hu-HU",
          "name": "KVÓCIENS"
        },
        {
          "locale": "id-ID",
          "name": "QUOTIENT"
        },
        {
          "locale": "it-IT",
          "name": "QUOTIENT"
        },
        {
          "locale": "ja-JP",
          "name": "QUOTIENT"
        },
        {
          "locale": "ko-KR",
          "name": "QUOTIENT"
        },
        {
          "locale": "lt-LT",
          "name": "QUOTIENT"
        },
        {
          "locale": "lv-LV",
          "name": "QUOTIENT"
        },
        {
          "locale": "nb-NO",
          "name": "KVOTIENT"
        },
        {
          "locale": "nl-NL",
          "name": "QUOTIENT"
        },
        {
          "locale": "pl-PL",
          "name": "CZ.CAŁK.DZIELENIA"
        },
        {
          "locale": "pt-BR",
          "name": "QUOTIENT"
        },
        {
          "locale": "pt-PT",
          "name": "QUOCIENTE"
        },
        {
          "locale": "ro-RO",
          "name": "QUOTIENT"
        },
        {
          "locale": "ru-RU",
          "name": "ЧАСТНОЕ"
        },
        {
          "locale": "sk-SK",
          "name": "QUOTIENT"
        },
        {
          "locale": "sl-SI",
          "name": "QUOTIENT"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "QUOTIENT"
        },
        {
          "locale": "sv-SE",
          "name": "KVOT"
        },
        {
          "locale": "th-TH",
          "name": "QUOTIENT"
        },
        {
          "locale": "tr-TR",
          "name": "BÖLÜM işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "QUOTIENT"
        },
        {
          "locale": "vi-VN",
          "name": "QUOTIENT"
        },
        {
          "locale": "zh-CN",
          "name": "QUOTIENT"
        },
        {
          "locale": "zh-HK",
          "name": "QUOTIENT"
        },
        {
          "locale": "zh-TW",
          "name": "QUOTIENT"
        }
      ],
      "signature": {
        "display": "QUOTIENT(numerator, denominator)",
        "parameters": [
          {
            "description": null,
            "name": "numerator",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "denominator",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "QUOTIENT",
      "version_marker": null,
      "xlcall": {
        "code": "417",
        "symbol": "xlfQuotient"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/quotient-function-9f7bf099-2a18-4282-8fa4-65290cc99dee"
  },
  "try_it": {
    "formula": "=QUOTIENT(7,3)"
  },
  "url": "https://handbook.dnacalc.com/functions/QUOTIENT.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "93 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.QUOTIENT.json"
      ]
    },
    {
      "behaviour": "3,119 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.QUOTIENT.json"
      ]
    }
  ]
}