Operators

Addition (+)

Known larger differences on 3 of 1,447 recorded answers

Of 1,447 recorded answers (1,447 workbook cells), 3 do not match: 3 differ in kind or value. How we measure this · See the Rust code

No local names are recorded for this entry.

What it does

number1 + number2

A + B converts each operand to a number and returns their IEEE-754 binary64 sum, rounded once to nearest with ties to even.

The arithmetic is the easy half. The interesting half is everything the sentence assumes:

  1. The conversion is per-operand and can fail. Each operand goes through the shared to-number rules of coercion and lifting: a number is itself; a logical is 1 or 0; text that reads as a number parses; text that does not is a named coercion failure; an error value propagates rather than converting.
  2. The result is one rounded double, not an exact sum. + is therefore not associative: (a+b)+c and a+(b+c) are different functions of the same three numbers, and a workbook that reassociates a chain of + can change its last bits.

+ is a two-argument function in this model, not a variadic one. SUM is a different function with a different coercion policy, not + folded over a list — the direct-argument versus range-scan asymmetry described in chapter 02 is exactly where the two part company.

Arguments

PositionNameMeaning
0ALeft addend. Required.
1BRight addend. Required.

Arity is exactly 2 (Arity { min: 2, max: 2 }); there are no optional arguments and no defaults. + is commutative on numbers up to the sign of a zero result, so operand order is not semantically load-bearing the way it is for -, / and ^ — but it is still two positions, and an array-shaped left operand and an array-shaped right operand broadcast against each other by the rules below.

The typed surface has a second + that is not this function: prefix +x is FUNC.OP_UNARY_PLUS, a one-argument operator with materially different operand handling. Confusing the two is the most common misreading of this row.

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

Quirks

Result and edge cases

  • Text operands. Governed by the shared to-number rule, not by anything specific to +. The locale-dependent part of Excel's text-to-number recognizer (thousands separators, currency symbols, date text) is flagged as an open area in chapter 02 and is not settled here.
  • Logical operands. Convert to 1 and 0 by the shared rule.
  • Empty and omitted. Chapter 02 keeps Empty (a blank cell) and Missing (an omitted argument slot) distinct at the call boundary, and states that what a function does with each is per-family policy. This Handbook has not recorded +'s policy for a blank operand against Excel. It is the first thing to probe.

How to implement

Notes for implementers

  • Implement + as a two-operand kernel over already-coerced doubles and put every interesting decision in the coercion and broadcast layers, where it is shared and testable once. That is the shape the reference implementation uses, and it is why the operator's own module is small.
  • Do not reassociate. A compiler or expression optimizer that rewrites (a+b)+c into a+(b+c) changes results in the last bits and breaks any comparison against Excel.
  • Broadcast is not zip. Row-vs-column operands produce a two-dimensional grid, not a diagonal, and missing coordinates are #N/A values inside the result array, not a whole-call failure.
  • + is declared SafePure, Deterministic and NonVolatile, with no host interaction, so it is safe to evaluate off the calculation thread.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

+ infix · 1 lines · calc-func/src/catalogue/arithmetic.rs on GitHub
CatalogueEntry::operator(PLUS, "+", Notation::Infix, NUMBERS, plus)
plus · 6 lines · calc-func/src/catalogue/arithmetic.rs on GitHub
fn plus(
    arguments: &[CalcValue],
    services: &mut EvalServices<'_>,
) -> Result<CalcValue, FunctionFault> {
    binary(PLUS, arguments, services, Site::add)
}

Kernels shared with other functions

Argument and result plumbing

No implementation has been published with a Handbook test suite for this function.

Version differences

No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.

Alternatives

Relationships

  • FUNC.OP_SUBTRACT, FUNC.OP_MULTIPLY, FUNC.OP_DIVIDE, FUNC.OP_POWER — the other binary arithmetic operators. They share the coercion story and differ in domain and error set.
  • FUNC.OP_UNARY_PLUS — same character, different function.
  • SUM — the aggregate. A1+A2 and SUM(A1:A2) are not interchangeable: SUM scans a range under the ignore-text-and-empty policy, while + coerces its operands directly. With "3" stored as text in A1, that difference is visible in the result.
  • IMSUM — complex addition over text-encoded complex numbers; unrelated machinery.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents