{
  "category": "Math and trigonometry functions",
  "display_name": "ODD",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.ODD",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20430"
      ],
      "larger_numeric": 0,
      "last_bit": 0,
      "matched": 1225,
      "other_mismatch": 0,
      "refused": 2,
      "rows": 1227,
      "unread": 0,
      "worst_ulp": 0
    },
    "detail": "Of 1,374 recorded answers (1,227 in the answer bank and 147 workbook cells), 2 do not match: 2 are refused.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "differs",
    "state_label": "Known larger differences",
    "summary": "Refuses 2 of 1,374 recorded calls; the rest match",
    "workbook_corpus": {
      "cells": 147,
      "matched": 147
    }
  },
  "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#L117-L117"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/rounding::call",
        "catalogue/rounding::numeric",
        "catalogue/rounding::numbers",
        "catalogue/rounding::abs",
        "catalogue/rounding::odd",
        "catalogue/rounding::to_parity",
        "decimal::truncate",
        "decimal::ceil"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/rounding.rs#L117-L117",
      "state": "differs",
      "suite": null,
      "summary": "Refuses 2 of 1,374 recorded calls; the rest match"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.ODD.json",
  "name": "ODD",
  "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- **`EVEN`** — the twin, rounding away from zero to an even integer. The pair are not inverses and\n  do not compose usefully; they partition nothing. Note the asymmetry recorded above: `EVEN`'s\n  postcondition survives the 2^53 wall and `ODD`'s does not.\n- **[ISEVEN](FUNC.ISEVEN.md) / `ISODD`** — the parity *tests*, which truncate toward zero. `ODD`\n  is a rounding function, not a predicate, and `ISODD(ODD(x))` is true by construction only below\n  the wall.\n- **[MROUND](FUNC.MROUND.md)** — rounds to the nearest multiple. `ODD` is not `MROUND(x, 2)` with\n  an offset: `MROUND` rounds to *nearest* while `ODD` rounds *away*, so they agree only when the\n  argument is already past the midpoint.\n- **[INT](FUNC.INT.md)** and **`TRUNC`** — the other integer-valued roundings, each with a\n  different convention. This category has floor, truncate-toward-zero, away-from-zero and\n  half-away-from-zero all in play, and the names do not disclose which is which.\n- **[ROUNDUP](FUNC.ROUNDUP.md)** — rounds away from zero to a number of decimal places;\n  `ROUNDUP(x, 0)` is the away-from-zero integer rounding without the parity constraint.\n- The most common real use is column and row banding, and generating alternating series — both of\n  which stay in the small-integer range where none of this page's edge cases can arise.\n\n\n",
    "how-to-implement": "\n### Numerical notes\n\n\n`ODD` performs no transcendental work and, below the representability wall, no rounding of its\nown. Its numerical character comes from three places.\n\n**Discontinuity amplification.** Like [INT](FUNC.INT.md), `ODD` is a step function, so a sub-ULP\nerror in its argument becomes a full step — here a jump of **2**, not 1 — whenever the argument\nstraddles a step boundary. The boundaries are the odd integers themselves: an argument that ought\nto be exactly 3 but arrives as the next double above 3 is rounded to 5. Anything computed and then\npassed to `ODD` should be rounded to an integer first if the intent was an integer.\n\n**The representability wall**, described in full above. An implementation that computes\n`2*ceil((|x|-1)/2)+1` in floating point does not merely return an even number above 2^53 — the\nintermediate `|x|-1` is itself a no-op there (subtracting 1 from a double spaced 2 apart returns\nthe same double), so the formula degenerates to the identity. That the naive formula and the\ncorrect-by-convention answer coincide is a coincidence, not a design, and an implementation that\nconverts through a fixed-width integer instead will produce something different — or wrap — at the\nsame inputs.\n\n**The sign of zero.** `ODD(-0.0)` has an argument whose sign bit is set but whose value is zero,\nso the \"away from zero\" direction is even less determined than at +0. Whether an implementation\nconsults the sign bit is a decision; it should be a recorded one.\n\nThe relevant background is not a special-function reference — there is no series to sum here — but\nthe general treatment of rounding to an integer lattice and the exactness of the operations\ninvolved: IEEE 754-2019's `roundToIntegral*` family, and Muller et al., *Handbook of\nFloating-Point Arithmetic*, on the spacing of binary64 and on rounding to a grid.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nReturns `Number` — an integer value.\n\n- **Zero** returns +1, as discussed above. Undocumented.\n- **−1** is returned unchanged, matching the documented example.\n- **A logical argument** converts and rounds; **numeric text** converts and rounds.\n- **The smallest positive subnormal** rounds to 1 — every strictly positive value below 1 does.\n- **An inline array** lifts elementwise.\n- **An empty range** produces `#VALUE!`.\n- **The largest finite double is returned unchanged** — and it is an **even** integer. See below;\n  this is not a rounding decision, it is a representability wall.\n\n### The postcondition fails above 2^53\n\n`ODD` promises an odd result. Above 2^53 it cannot deliver one, and the reason is arithmetic\nrather than implementation.\n\nBinary64 spaces consecutive representable values 2 apart in [2^53, 2^54), 4 apart in\n[2^54, 2^55), and so on. **Every finite double of magnitude at or above 2^53 is an even integer**,\nbecause it is a multiple of at least 2. There is no odd double above that point. So for any\nargument in that range:\n\n- returning the argument unchanged gives an **even** answer, violating the function's defining\n  property; and\n- returning \"the next odd integer\" is impossible, because that integer is not representable —\n  the nearest doubles either side are both even.\n\nThe same wall governs `EVEN` in mirror image, where the story is happier: above 2^53 every double\nalready *is* even, so `EVEN`'s postcondition survives exactly where `ODD`'s fails.\n\n\n\n### Errors\n\n\n| Error | Condition | Basis |\n|---|---|---|\n| `#VALUE!` | The argument is nonnumeric | **Documented**: \"If number is nonnumeric, ODD returns the #VALUE! error value.\" |\n| propagated | An error value in the argument | Shared call model |\n\nThere is no documented domain error, and none is needed: `ODD` is total on the reals.\n\n\n",
    "sources": "- Microsoft, \"ODD function\" —\n  <https://support.microsoft.com/en-us/office/odd-function-deae64eb-e08a-4c88-8b40-6d0b42575c98>.\n  Retrieved for this page: the syntax, the argument description, the `#VALUE!` nonnumeric remark,\n  the away-from-zero rule, the no-rounding-for-odd-integers remark, and the five worked examples.\n  The page as retrieved says nothing about zero and nothing about large magnitudes.\n- IEEE 754-2019 — binary64 value spacing and the `roundToIntegral*` operations;\n  J.-M. Muller et al., *Handbook of Floating-Point Arithmetic*, 2nd edition — spacing of the\n  binary64 grid and rounding to a lattice.\n- Handbook, [INT](FUNC.INT.md) — the amplification hazard shared by every step function in this\n  category; [ISEVEN](FUNC.ISEVEN.md) — the parity predicate and its own 2^53 discussion;\n  [coercion and lifting](../model/02-coercion-and-lifting.md) — to-number outcomes, scalar-kernel\n  lifting, error propagation.\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| 19929 | Windows, bitness not recorded, CPU not recorded | 41 |\n| 20430 | Windows, 64-bit, CPU not recorded | 1,227 |\n\n- XC-ODD-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.ODD.json).",
    "what-it-does": "\n`ODD(number)` rounds *number* **away from zero** to the nearest odd integer.\n\nMicrosoft's two remarks give the rule completely:\n\n> \"Regardless of the sign of number, a value is rounded up when adjusted away from zero.\"\n>\n> \"If number is an odd integer, no rounding occurs.\"\n\nSo the direction is outward from zero in both half-planes — 1.5 rises to 3, and −2 falls to −3 —\nand an argument already on an odd integer is returned unchanged. The documented examples pin all\nfive cases: 1.5 → 3, 3 → 3, 2 → 3, −1 → −1, −2 → −3.\n\nWritten out:\n\n    ODD(x) = sign(x) · ( 2·⌈ (|x| − 1)/2 ⌉ + 1 )\n\n**Domain and range.** Domain: all reals. Range: the odd integers — with two qualifications, one\nat zero and one at the top of the floating-point range, both below.\n\n**Shape.** A staircase with steps of width 2 and jump 2, symmetric under *x* ↦ −*x* (the function\nis odd in the algebraic sense as well as in the arithmetic one: ODD(−x) = −ODD(x) away from zero).\nIt is idempotent — ODD(ODD(x)) = ODD(x) — and it is the away-from-zero counterpart of `EVEN`,\nwhich does the same thing to an even lattice.\n\n\n### Arguments\n\n\n| Argument | Meaning | Required |\n|---|---|---|\n| `number` | \"The value to round.\" | Yes |\n\nExactly one argument; the declared arity is one to one. The slot is numeric and subject to\nordinary to-number coercion ([coercion and lifting](../model/02-coercion-and-lifting.md)). The\ndeclared coercion profile is the unary numeric scalar-or-array-elementwise one, so `ODD` is a\nscalar kernel that lifts over arrays.\n\n\n"
  },
  "signature": {
    "display": "ODD(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": "NumToNum",
        "rich_value_usage": "RichBlind",
        "surface_fec_dependency_profile": "RefOnly",
        "thread_safety_class": "SafePure",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": "Number rounded away from zero to an odd whole number",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Rounds a number up to the nearest odd integer",
        "microsoft_url": "https://support.microsoft.com/en-us/office/odd-function-deae64eb-e08a-4c88-8b40-6d0b42575c98"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "ODD"
        },
        {
          "locale": "bg-BG",
          "name": "ODD"
        },
        {
          "locale": "cs-CZ",
          "name": "ZAOKROUHLIT.NA.LICHÉ"
        },
        {
          "locale": "da-DK",
          "name": "ULIGE"
        },
        {
          "locale": "de-DE",
          "name": "ODD"
        },
        {
          "locale": "el-GR",
          "name": "ODD"
        },
        {
          "locale": "en-AU",
          "name": "ODD"
        },
        {
          "locale": "en-GB",
          "name": "ODD"
        },
        {
          "locale": "en-US",
          "name": "ODD"
        },
        {
          "locale": "es-ES",
          "name": "REDONDEA.IMPAR"
        },
        {
          "locale": "et-EE",
          "name": "ODD"
        },
        {
          "locale": "fi-FI",
          "name": "PARITON"
        },
        {
          "locale": "fr-FR",
          "name": "IMPAIR*"
        },
        {
          "locale": "he-IL",
          "name": "ODD"
        },
        {
          "locale": "hr-HR",
          "name": "ODD"
        },
        {
          "locale": "hu-HU",
          "name": "PÁRATLAN"
        },
        {
          "locale": "id-ID",
          "name": "ODD"
        },
        {
          "locale": "it-IT",
          "name": "ODD"
        },
        {
          "locale": "ja-JP",
          "name": "ODD"
        },
        {
          "locale": "ko-KR",
          "name": "ODD"
        },
        {
          "locale": "lt-LT",
          "name": "ODD"
        },
        {
          "locale": "lv-LV",
          "name": "ODD"
        },
        {
          "locale": "nb-NO",
          "name": "ODDETALL"
        },
        {
          "locale": "nl-NL",
          "name": "ONEVEN"
        },
        {
          "locale": "pl-PL",
          "name": "ZAOKR.DO.NPARZ"
        },
        {
          "locale": "pt-BR",
          "name": "ODD"
        },
        {
          "locale": "pt-PT",
          "name": "ÍMPAR"
        },
        {
          "locale": "ro-RO",
          "name": "ODD"
        },
        {
          "locale": "ru-RU",
          "name": "НЕЧЁТ"
        },
        {
          "locale": "sk-SK",
          "name": "ODD"
        },
        {
          "locale": "sl-SI",
          "name": "ODD"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "ODD"
        },
        {
          "locale": "sv-SE",
          "name": "UDDA"
        },
        {
          "locale": "th-TH",
          "name": "ODD"
        },
        {
          "locale": "tr-TR",
          "name": "TEK işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "ODD"
        },
        {
          "locale": "vi-VN",
          "name": "ODD"
        },
        {
          "locale": "zh-CN",
          "name": "ODD"
        },
        {
          "locale": "zh-HK",
          "name": "ODD"
        },
        {
          "locale": "zh-TW",
          "name": "ODD"
        }
      ],
      "signature": {
        "display": "ODD(number)",
        "parameters": [
          {
            "description": null,
            "name": "number",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "ODD",
      "version_marker": null,
      "xlcall": {
        "code": "298",
        "symbol": "xlfOdd"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/odd-function-deae64eb-e08a-4c88-8b40-6d0b42575c98"
  },
  "try_it": {
    "formula": "=ODD(0)"
  },
  "url": "https://handbook.dnacalc.com/functions/ODD.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "41 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.ODD.json"
      ]
    },
    {
      "behaviour": "1,227 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.ODD.json"
      ]
    }
  ]
}