{
  "category": "Math and trigonometry functions",
  "display_name": "EVEN",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.EVEN",
  "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,373 recorded answers (1,227 in the answer bank and 146 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,373 recorded calls; the rest match",
    "workbook_corpus": {
      "cells": 146,
      "matched": 146
    }
  },
  "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#L116-L116",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/rounding.rs#L711-L719"
      ],
      "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#L116-L116",
      "state": "differs",
      "suite": null,
      "summary": "Refuses 2 of 1,373 recorded calls; the rest match"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.EVEN.json",
  "name": "EVEN",
  "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- **`ODD`** — the parity partner, rounding away from zero to an odd integer. The pair is not\n  symmetric: `ODD` has no fixed point at zero (`ODD(0)` is documented as 1) and its identity\n  region above `2^53` does not exist, because no double above `2^53` is odd. That asymmetry\n  makes `ODD` the more interesting of the two at the top of the range and `EVEN` the more\n  interesting at the bottom.\n- **`CEILING.MATH`** — the general away-from-zero-or-toward-`-∞` rounding.\n  `CEILING.MATH(x, 2, 1)` is the away-from-zero reading and coincides with `EVEN` there;\n  `CEILING.MATH(x, 2)` with the default mode rounds negatives toward `-∞` and does **not**\n  match `EVEN`. Substituting one for the other on a column containing negatives changes results.\n- **[FLOOR.MATH](FUNC.FLOOR.MATH.md), `FLOOR.PRECISE`** — the downward\n  family, for contrast: they round toward `-∞`, where `EVEN` rounds away from zero. The\n  worksheet's rounding functions do not share a single direction convention, and knowing which\n  convention a given one uses is most of the skill in choosing between them.\n- **`ROUNDUP`** — rounds away from zero to a digit position, the same *direction* convention as\n  `EVEN` with a different *grid*.\n- **`MROUND(x, 2)`** — rounds to the nearest multiple of 2 rather than away from zero, so it\n  disagrees with `EVEN` on every argument in the lower half of each tread.\n- **`ISEVEN`** — the predicate, which tests parity rather than producing it, and which\n  truncates rather than rounding.\n\n\n",
    "how-to-implement": "\n### Numerical notes\n\n\n`EVEN` is one of the few functions in this batch that can be, and should be, **exact**.\n\nEvery step of the closed form is exact in binary64:\n\n1. `ABS(x)` is exact — a sign-bit clear.\n2. `ABS(x) / 2` is exact — division by a power of two only changes the exponent, and it cannot\n   underflow into the subnormal range in a way that loses bits unless `x` was already subnormal,\n   where the result is `0` or `2` anyway.\n3. `ceil` is exact — it is an IEEE 754 `roundToIntegral` operation, which is by definition\n   exactly rounded and, for a value already integral, the identity.\n4. Multiplying by 2 is exact, and cannot overflow: the input to this step is at most\n   `ceil(DBL_MAX/2)`, so the product is at most `DBL_MAX`.\n\nSo a correct implementation commits **no rounding error at all** on any argument, and any\ndisagreement between two implementations of `EVEN` is a disagreement about the *rule*, never\nabout the arithmetic. That is a rare and pleasant situation, and it means the interesting probes\nhere are all about tie behaviour and sign conventions rather than about ulp.\n\nTwo traps for implementers:\n\n- **Do not use `2 * ceil(x / 2)` without the absolute value.** For negative `x`, `ceil` rounds\n  toward `+∞`, i.e. *toward* zero, which is the opposite of the documented rule. The sign must\n  be factored out first and restored afterwards.\n- **Do not test \"is already even\" by `MOD(x, 2) = 0`** on large arguments. Above `2^53` this is\n  true of everything, which happens to be correct, but the test itself involves a division that\n  is exact only because of the power of two; the same pattern with a non-power-of-two step is\n  not exact, and the habit transfers badly to `MROUND` and `CEILING.MATH`.\n\nThe identity region above `2^53` deserves one more sentence, because it is a fact about the\nformat that this function makes visible: a spreadsheet user who applies `EVEN` to a large\nidentifier — an account number stored as a number, say — will see it returned unchanged and may\nconclude the function is broken. It is not; the value was already even, and had been since it\ncrossed `2^53`.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nReturns `Number`, always an even integer.\n\n- **Zero** — `EVEN(0)` is `0`. Zero is even, so no adjustment is required, and the closed form\n  above handles it as the degenerate case rather than as an exception.\n- **Negative arguments** — move away from zero: an argument between `-2` and `0` becomes `-2`.\n  This is the documented rule and it is the opposite of what \"round up\" would mean if read as\n  \"toward `+∞`\". Microsoft's own wording — a value is rounded *up* when adjusted *away* from\n  zero — is a definition of \"up\" as \"away from zero\", and the whole page turns on it.\n- **Already-even integers** — unchanged, documented explicitly.\n- **Odd integers** — move by exactly 1, away from zero.\n- **Values already above `2^53`** — unchanged, as above.\n- **Signed zero** — an argument of `-0` is at a fixed point; whether the sign survives is not\n  documented and has not been checked.\n\n\n\n### Errors\n\n\nAs documented on Microsoft's `EVEN` page:\n\n| Error | Condition |\n|---|---|\n| `#VALUE!` | `number` is non-numeric |\n\nNo other error condition is documented, and none is structurally required: the function cannot\noverflow and has no domain restriction.\n\n\n",
    "sources": "- IEEE 754-2019 — `roundToIntegral` operations and the exactness of scaling by a power of two.\n- Muller et al., *Handbook of Floating-Point Arithmetic* — integer-valued doubles and the\n  spacing argument behind the identity region.\n- Handbook, [Coercion and lifting](../model/02-coercion-and-lifting.md) and\n  [The value universe](../model/01-value-universe.md).\n- Handbook projections `data/functions/FUNC.EVEN.json` (arity, the elementwise lift profile, the\n  `non_finite=allow` axis value) and `data/presence/FUNC.EVEN.json` (which records no\n  discrepancy, deviation or defect-stream mention for this surface).\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 | 43 |\n| 20430 | Windows, 64-bit, CPU not recorded | 1,227 |\n\n- XC-EVEN-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.EVEN.json).",
    "what-it-does": "\n`EVEN(number)` rounds its argument to an even integer, moving **away from zero**. Microsoft's\npage states the rule in exactly that form: regardless of the sign, the adjustment is away from\nzero, and an argument that is already an even integer is not moved.\n\nIn closed form:\n\n    EVEN(x) = 2 · sign(x) · ceil( ABS(x) / 2 )      for x ≠ 0\n    EVEN(0) = 0\n\n| Property | Statement |\n|---|---|\n| Domain | all real `x` |\n| Range | the even integers representable as doubles |\n| Parity of the map | odd: `EVEN(-x) = -EVEN(x)` |\n| Idempotent | `EVEN(EVEN(x)) = EVEN(x)` |\n| Monotone | non-decreasing |\n| Step | 2 — the function is a staircase with treads of width 2, not 1 |\n| Fixed points | exactly the even integers |\n| Bound | `ABS(EVEN(x)) ≥ ABS(x)`, with equality only at the fixed points |\n| Identity above `2^53` | `EVEN(x) = x` for every double with `ABS(x) ≥ 2^53` |\n\nThe last row is the one that surprises people, and it is pure format arithmetic rather than\nfunction design. Above `2^53` the spacing between consecutive doubles is at least 2, so **every\nrepresentable value in that range is already an even integer**. `EVEN` is therefore the identity\nmap on the entire upper half of the format's range, and the function only does anything at all\nbelow `2^53`.\n\nThe half-open-interval reading is worth keeping in mind: `EVEN` maps `(0, 2]` to `2`, `(2, 4]`\nto `4`, and symmetrically on the negative side. The endpoints belong to the *lower* tread\nbecause an even integer is not moved.\n\n\n\n### Arguments\n\n\n| Argument | Meaning | Notes |\n|---|---|---|\n| `number` | The value to round. Required. | Microsoft documents no constraint |\n\n"
  },
  "signature": {
    "display": "EVEN(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 even whole number",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Rounds a number up to the nearest even integer",
        "microsoft_url": "https://support.microsoft.com/en-us/office/even-function-197b5f06-c795-4c1e-8696-3c3b8a646cf9"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "EVEN"
        },
        {
          "locale": "bg-BG",
          "name": "EVEN"
        },
        {
          "locale": "cs-CZ",
          "name": "ZAOKROUHLIT.NA.SUDÉ"
        },
        {
          "locale": "da-DK",
          "name": "LIGE"
        },
        {
          "locale": "de-DE",
          "name": "EVEN"
        },
        {
          "locale": "el-GR",
          "name": "EVEN"
        },
        {
          "locale": "en-AU",
          "name": "EVEN"
        },
        {
          "locale": "en-GB",
          "name": "EVEN"
        },
        {
          "locale": "en-US",
          "name": "EVEN"
        },
        {
          "locale": "es-ES",
          "name": "REDONDEA.PAR"
        },
        {
          "locale": "et-EE",
          "name": "EVEN"
        },
        {
          "locale": "fi-FI",
          "name": "PARILLINEN"
        },
        {
          "locale": "fr-FR",
          "name": "PAIR*"
        },
        {
          "locale": "he-IL",
          "name": "EVEN"
        },
        {
          "locale": "hr-HR",
          "name": "EVEN"
        },
        {
          "locale": "hu-HU",
          "name": "PÁROS"
        },
        {
          "locale": "id-ID",
          "name": "EVEN"
        },
        {
          "locale": "it-IT",
          "name": "EVEN"
        },
        {
          "locale": "ja-JP",
          "name": "EVEN"
        },
        {
          "locale": "ko-KR",
          "name": "EVEN"
        },
        {
          "locale": "lt-LT",
          "name": "EVEN"
        },
        {
          "locale": "lv-LV",
          "name": "EVEN"
        },
        {
          "locale": "nb-NO",
          "name": "AVRUND.TIL.PARTALL"
        },
        {
          "locale": "nl-NL",
          "name": "EVEN"
        },
        {
          "locale": "pl-PL",
          "name": "ZAOKR.DO.PARZ"
        },
        {
          "locale": "pt-BR",
          "name": "EVEN"
        },
        {
          "locale": "pt-PT",
          "name": "PAR"
        },
        {
          "locale": "ro-RO",
          "name": "EVEN"
        },
        {
          "locale": "ru-RU",
          "name": "ЧЁТН"
        },
        {
          "locale": "sk-SK",
          "name": "EVEN"
        },
        {
          "locale": "sl-SI",
          "name": "EVEN"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "EVEN"
        },
        {
          "locale": "sv-SE",
          "name": "JÄMN"
        },
        {
          "locale": "th-TH",
          "name": "EVEN"
        },
        {
          "locale": "tr-TR",
          "name": "ÇİFT"
        },
        {
          "locale": "uk-UA",
          "name": "EVEN"
        },
        {
          "locale": "vi-VN",
          "name": "EVEN"
        },
        {
          "locale": "zh-CN",
          "name": "EVEN"
        },
        {
          "locale": "zh-HK",
          "name": "EVEN"
        },
        {
          "locale": "zh-TW",
          "name": "EVEN"
        }
      ],
      "signature": {
        "display": "EVEN(number)",
        "parameters": [
          {
            "description": null,
            "name": "number",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "EVEN",
      "version_marker": null,
      "xlcall": {
        "code": "279",
        "symbol": "xlfEven"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/even-function-197b5f06-c795-4c1e-8696-3c3b8a646cf9"
  },
  "try_it": {
    "formula": "=EVEN(0)"
  },
  "url": "https://handbook.dnacalc.com/functions/EVEN.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "43 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.EVEN.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.EVEN.json"
      ]
    }
  ]
}