Math and trigonometry functions

ROUND

Close: 124 of 37,138 recorded answers differ in the last bits, worst 16 ULP

Everything else matches (36,945 in the answer bank and 193 workbook cells). Last-bit means a finite number within 16 ULP of Excel's. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicROUND
BulgarianROUND
CzechZAOKROUHLIT
DanishAFRUND
GermanROUND
GreekROUND
English (Australia)ROUND
English (United Kingdom)ROUND
English (United States)ROUND
SpanishREDONDEAR
EstonianROUND
FinnishKIERROS
FrenchARRONDI
HebrewROUND
CroatianROUND
HungarianKEREKÍTÉS
IndonesianROUND
ItalianROUND
JapaneseROUND
KoreanROUND
LithuanianROUND
LatvianROUND
NorwegianAVRUND
DutchRONDE
PolishZAOKR
Portuguese (Brazil)ROUND
Portuguese (Portugal)ARRED
RomanianROUND
RussianОКРУГЛ
SlovakKOLO
SlovenianROUND
Serbian (Latin)ROUND
SwedishAVRUNDA
ThaiROUND
TurkishYUVARLA
UkrainianROUND
VietnameseROUND
Chinese (Simplified)ROUND
Chinese (Hong Kong)ROUND
Chinese (Traditional)ROUND

Names from Microsoft's support site.

What it does

ROUND(number, num_digits)

ROUND(number, num_digits) rounds to the nearest decimal position, with final decimal halves away from zero. Positive digit counts address places after the decimal point, zero the integer position, and negative counts places to its left.

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.

=ROUND(-7.25,1) returns -7.3; =ROUND(725,-1) returns 730. A final half goes away from zero, including for negative values.

Quirks

The recorded functions first read fifteen significant decimal digits. Asking to retain more digits can therefore change an input that mathematically needs no rounding. For example, the recorded ROUND(-1594628480062905,14) returns -1594628480062900. Huge digit counts have recorded integer-conversion behaviour rather than a simple “keep everything” rule. Near the normal-range boundary and overflow, worksheet publication needs separate handling.

Near the largest finite input, the recorded decimal output can carry NaN bits while Excel classifies the cell as a number. The overflow model and its save/reopen behavior are separate from ordinary IEEE infinity publication. See the packing rules and worked encodings.

ROUND counts digits in 32 bits, and the count wraps

ROUND cuts num_digits toward zero to a 32-bit integer D, limited to +/-2147483647, and keeps k = D + e + 1 significant digits, where e is the decimal exponent of |number| and the sum is computed in 32 bits. k of 15 or more keeps the 15-digit reading of the number; k below 0 gives 0. A large positive num_digits therefore wraps to no digits at all: for a number near 1.1E14, 2147483617 returns the number and 2147483635 returns 0. The boundaries move by exactly -e on both the +2^31 and -2^31 sides, for e from -308 to 308. num_digits of 2^31 or more acts as +2147483647 and -2^31 or less as -2147483647.

FormulaExcelMathematical value
ROUND(-112500000000000, 2147483635)
Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture
Inputs and reference value

Number supplied through a cell.

number: -112500000000000
0xc2d9945ca2620000

num_digits: 2147483635
0x41dffffffcc00000

-112500000000000 is an integer, so rounding it to any non-negative number of places returns it.

0
0x0000000000000000
-112500000000000
0xc2d9945ca2620000
ROUND(-112500000000000, 2147483617)
Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture
Inputs and reference value

Number supplied through a cell.

number: -112500000000000
0xc2d9945ca2620000

num_digits: 2147483617
0x41dffffff8400000

-112500000000000
0xc2d9945ca2620000
—

Inputs, build details and evidence

The rounding functions read 15 digits first, so ROUNDDOWN can round up

Before choosing a digit these functions read the number to 15 significant digits on the x87 unit: with e the decimal exponent and n = 14 - e, y = RN64(|x| * 10^n), or RN64(|x| / 10^-n) when n is negative, while 10^|n| is exact in 64 bits (|n| <= 27). A half in y goes up for ROUNDDOWN, ROUNDUP and TRUNC and down for ROUND. So digits beyond the 15th are lost even when the requested precision keeps them: ROUND(-1594628480062905,14) loses its last digit, and ROUNDDOWN(283025097725723.5,0) returns 283025097725724, larger than its input.

FormulaExcelMathematical value
ROUND(-1594628480062905, 14)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

number: -1594628480062905
0xc316a939806956e4

num_digits: 14
0x402c000000000000

An integer rounded to 14 places is itself.

-1594628480062900
0xc316a939806956d0
-1594628480062905
0xc316a939806956e4
ROUNDDOWN(283025097725723.5, 0)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

number: 283025097725723.5
0x42f0168ea69971b8

num_digits: 0
0x0000000000000000

ROUNDDOWN drops the fraction .5.

283025097725724
0x42f0168ea69971c0
283025097725723
0x42f0168ea69971b0

Inputs, build details and evidence

Near DBL_MAX, ROUND returns NaN bit patterns that Excel treats as numbers

ROUND of a number near 1.8E308 can return a binary64 with an all-ones exponent field. A decimal result of 2^1024 or more keeps its 53-bit significand, and its exponent is carried into the exponent field without a check, so the bits are a NaN. ROUND, ROUNDDOWN and TRUNC return those bits; ROUNDUP gives #NUM!. The recorded rows hold 430 such ROUND rows, 102 ROUNDDOWN and 95 TRUNC, and all 627 follow this. Even ROUND(DBL_MAX,0), whose answer is DBL_MAX, returns 0x7ff000000000000a. The cell shows 2E+308 or 1.8E+308, and a pattern with its sign bit set shows 2E+308 too, with no minus. ISNUMBER gives TRUE, ISERROR FALSE, TYPE 1, ERROR.TYPE #N/A; A1=A1 and A1>0 are TRUE. =A1, N(A1), MAX(A1), ABS(A1) and IFERROR(A1,...) pass the pattern on, as does =-A1 with its sign unchanged. Arithmetic on it (A1+0, A1*1, A1-A1, SUM, ROUND) gives #NUM!, and TEXT(A1,"0") gives #VALUE!. Saved to .xlsx, each such cell is written as the error #NUM!; reopened, the cells read #NUM! until a full recalculation brings the patterns back.

Explanation (inferred): That one decimal-to-binary conversion routine is the source of all these patterns is inferred from the exponent-overflow encoding.

FormulaExcelMathematical value
ROUND(1.7976931348623157E+308, 0)
Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading
Inputs and reference value

Number supplied through a cell.

number: 1.7976931348623157e+308
0x7fefffffffffffff

num_digits: 0
0x0000000000000000

DBL_MAX is an integer, so rounding it to 0 places returns it.

NaN bit pattern, shown as 1.8E+308
0x7ff000000000000a
1.7976931348623157e+308
0x7fefffffffffffff
ROUND(1.7976931348623157E+308, -307)
Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading
Inputs and reference value

Number supplied through a cell.

number: 1.7976931348623157e+308
0x7fefffffffffffff

num_digits: -307
0xc073300000000000

The rounded value exceeds the largest binary64; Excel reports overflow in its own arithmetic as #NUM!.

NaN bit pattern, shown as 1.8E+308
0x7ff005419221015d
#NUM!
ROUND(1.7976931348623157E+308, -308)
Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading
Inputs and reference value

Number supplied through a cell.

number: 1.7976931348623157e+308
0x7fefffffffffffff

num_digits: -308
0xc073400000000000

The rounded value exceeds the largest binary64; Excel reports overflow in its own arithmetic as #NUM!.

NaN bit pattern, shown as 2E+308
0x7ff1ccf385ebc8a0
#NUM!

Inputs, build details and evidence

ROUND takes ties away from zero on the 15-digit reading, so 1.005 rounds up

A tie in ROUND goes away from zero, not to even: ROUND(2.5,0) is 3 and ROUND(-2.5,0) is -3. The tie is judged on the 15-digit reading of FN-ROUND-002, not on the stored value. So 1.005 and 2.675, whose binary64 values lie just below the decimal tie, count as ties: ROUND(1.005,2) is 1.01 and ROUND(2.675,2) is 2.68, where rounding the stored value would give 1 and 2.67.

Explanation (inferred): That every tie follows this is inferred from the rule's fit to the recorded rows; the literal ties read directly are the ones below.

FormulaExcelMathematical value
=ROUND(2.5,0)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

3
0x4008000000000000
—
=ROUND(-2.5,0)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

-3
0xc008000000000000
—
=ROUND(2.675,2)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

The stored value lies below the decimal tie, so the nearest multiple of 0.01 is the lower one; nearest binary64.

2.68
0x400570a3d70a3d71
2.67
0x40055c28f5c28f5c
=ROUND(1.005,2)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

The stored value lies below the decimal tie, so the nearest multiple of 0.01 is the lower one; nearest binary64.

1.01
0x3ff028f5c28f5c29
1
0x3ff0000000000000

Inputs, build details and evidence

How to implement

The current worksheet wrapper reads numeric arguments in order and flushes subnormal numeric operands to zero. Return zero for a zero number before finding its decimal exponent. The following steps start with a finite, nonzero admitted input. The stored-arithmetic chapter explains exact binary decoding and significand rounding.

First construct the number’s fifteen-significant-digit reading. Extract the exact binary64 value and find its decimal exponent e by comparisons with exact powers of ten, so 10^e <= abs(x) < 10^(e+1). Put s=14-e. When abs(s)<=27, evaluate abs(x)*10^s (or abs(x)/10^(-s)) with a 64-bit significand and extended exponent range, rounding to nearest/even. Do not store that scaled value to binary64 before the integer decision. Round it to an integer: exact halves go down for ROUND’s reading, up for the directed functions’ readings. Retain the sign and the exact decimal value integer*10^(-s).

This reading step is a measured reconstruction with a known counterexample even inside the stated scale range. For abs(s)>27, Excel’s scaling is still open; the current code falls back to exact binary64-to-decimal rounding to fifteen digits. That fallback is a candidate, not an identified Excel stage.

  1. Truncate num_digits toward zero, clamp to [-2147483647,2147483647], and call the integer D.
  2. Compute k=D+e+1 with signed 32-bit wrapping. A negative k returns zero; k>=15 keeps the reading.
  3. Otherwise round the exact decimal reading at unit 10^(-D), choosing the larger magnitude at a half. Convert the resulting decimal to nearest binary64. Preserve the original input if its exact value equals the whole reading.
  4. A final subnormal result is flushed to zero. For decimal overflow, apply the half-value and encoded-exponent rule. A host without the tagged worksheet-number representation must retain an explicit refusal.

Worked: x=-7.25 has e=0, s=14; its reading is exactly -7.25. For D=1, k=2. At unit 0.1 the magnitude is 72.5 units, so choose 73 and return the binary64 value for -7.3. For a count-overflow control, ROUND(1.5,2147483647) wraps k negative and returns zero on the recorded build.

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.

ROUND · 1 lines · calc-func/src/catalogue/rounding.rs on GitHub
call(ROUND, "ROUND", 2, DIGITS, round)
round · 9 lines · calc-func/src/catalogue/rounding.rs on GitHub
/// ROUND: to num_digits decimal places (left of the point when negative), a half away from zero.
fn round(
    arguments: &[CalcValue],
    services: &mut EvalServices<'_>,
) -> Result<CalcValue, FunctionFault> {
    numeric(ROUND, arguments, services, |site, n| {
        nearest_digits(site, n[0], n[1])
    })
}
nearest_digits · 28 lines · calc-func/src/catalogue/rounding.rs on GitHub
/// ROUND's kernel. num_digits counts as a 32-bit integer, toward zero and limited to
/// +/-2147483647, and ROUND keeps `digits + e + 1` significant digits of the number, e being its
/// decimal exponent, the sum taken in 32-bit two's complement: fifteen or more keep the whole
/// reading, fewer than none give 0, and otherwise the reading is rounded at 10^-digits. So
/// ROUND(1.5,2147483647) is 0 (the sum wraps negative) where 2147483646 leaves 1.5, and
/// ROUND(-5.480222088275654E-221,-2147483480.2228494) is -5.48022208827565E-221 (the sum wraps
/// positive), as Excel 16.0.20430 gives them (the OxFunc-Evidence bank's integer-threshold,
/// hyperbolic and count-refinement runs).
fn nearest_digits(site: &Site<'_>, number: f64, places: f64) -> Step<f64> {
    if number == 0.0 {
        return Ok(0.0);
    }
    let limit = f64::from(i32::MAX);
    // An integer within +/-2147483647, so the conversion is exact.
    let digits = decimal::truncate(places).clamp(-limit, limit) as i32;
    let kept = digits
        .wrapping_add(ExactDecimal::binary(number).magnitude())
        .wrapping_add(1);
    if kept < 0 {
        return Ok(0.0);
    }
    let reading = reading(number, false);
    // Without a wrap, kept from 0 to 14 bounds digits to within 340 of 0.
    match reading.round_at(-digits.clamp(-PLACES, PLACES), Direction::Nearest) {
        Some(rounded) if kept < 15 => Ok(flush(stored(site, &rounded)?)),
        _ => whole_reading(site, number, &reading),
    }
}

Kernels shared with other functions

Argument and result plumbing

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

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.

Excel 16.0 buildPlatform and CPUCaptured inputs
19929Windows, bitness not recorded, CPU not recorded135
20430Windows, 64-bit, AMD Ryzen 7 4800H with Radeon Graphics4,071
20430Windows, 64-bit, CPU not recorded32,874

The 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.

Recorded environments and comparison details.

Retained controls from the indexed captures:

Build and recorded CPUCaptured call or argumentsExcel result
19929, CPU not recorded=ROUND(-1.20410853043719857,0)-1.0 (0xbff0000000000000)
20430, AMD Ryzen 7 4800H with Radeon GraphicsROUND(0.5,0)1 (0x3ff0000000000000)
20430, CPU not recordedROUND(817094511.6142203,6)817094511.61422 (0x41c859efb7ce9ec3)

These are earlier recorded answers, not new Excel runs or an additional cross-build comparison. The function JSON retains each source locator, exact argument bits where available, and input-route status. Call notation does not imply that captured binary64 values were entered as decimal formula literals.

Excel 16.0 build 20430

Windows 64-bit, CPU not recorded in this capture

ROUND(-112500000000000, 2147483635) returned 0 (0x0000000000000000). ROUND(-112500000000000, 2147483617) returned -112500000000000 (0xc2d9945ca2620000). Inputs were supplied through cells using Value2. These are controls from this environment, not a same-input comparison with another build.

Observed formulas and results
  • ROUND(-112500000000000, 2147483635) → 0
    0x0000000000000000 (cell-value2)
  • ROUND(-112500000000000, 2147483617) → -112500000000000
    0xc2d9945ca2620000 (cell-value2)

Excel 16.0 build 20430

Windows 64-bit, AMD Ryzen 7 4800H

ROUND(-1594628480062905, 14) returned -1594628480062900 (0xc316a939806956d0). Inputs were supplied through cells using Value2. These are controls from this environment, not a same-input comparison with another build.

Observed formulas and results
  • ROUND(-1594628480062905, 14) → -1594628480062900
    0xc316a939806956d0 (cell-value2)

Excel 16.0 build 20527

Windows; bitness and CPU not recorded in this reading

ROUND(1.7976931348623157E+308, 0) returned NaN bit pattern, shown as 1.8E+308 (0x7ff000000000000a). ROUND(1.7976931348623157E+308, -307) returned NaN bit pattern, shown as 1.8E+308 (0x7ff005419221015d). 1 further recorded control is attached. Inputs were supplied through cells using Value2. These are controls from this environment, not a same-input comparison with another build.

Observed formulas and results
  • ROUND(1.7976931348623157E+308, 0) → NaN bit pattern, shown as 1.8E+308
    0x7ff000000000000a (cell-value2)
  • ROUND(1.7976931348623157E+308, -307) → NaN bit pattern, shown as 1.8E+308
    0x7ff005419221015d (cell-value2)
  • ROUND(1.7976931348623157E+308, -308) → NaN bit pattern, shown as 2E+308
    0x7ff1ccf385ebc8a0 (cell-value2)

Excel 16.0.20527.20088

Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA

=ROUND(2.5,0) returned 3 (0x4008000000000000). =ROUND(-2.5,0) returned -3 (0xc008000000000000). 2 further recorded controls are attached. Inputs were supplied through formula literals. These are controls from this environment, not a same-input comparison with another build.

Observed formulas and results
  • =ROUND(2.5,0) → 3
    0x4008000000000000 (formula-literal)
  • =ROUND(-2.5,0) → -3
    0xc008000000000000 (formula-literal)
  • =ROUND(2.675,2) → 2.68
    0x400570a3d70a3d71 (formula-literal)
  • =ROUND(1.005,2) → 1.01
    0x3ff028f5c28f5c29 (formula-literal)

Excel 16.0 build 19929

Windows, bitness not recorded, CPU not recorded

135 captured inputs are indexed for this environment. Capture dates are not recorded. This is a reading count, not a comparison with another build. Retained control =ROUND(-1.20410853043719857,0) returned -1.0 (0xbff0000000000000). The selected archive row does not record its input plumbing; no input route is inferred.

Observed formulas and results
  • =ROUND(-1.20410853043719857,0) → -1.0
    0xbff0000000000000 (not-recorded)

Excel 16.0 build 20430

Windows, 64-bit, AMD Ryzen 7 4800H with Radeon Graphics

4,071 captured inputs are indexed for this environment. Capture dates: 2026-09-25 to 2026-09-25. This is a reading count, not a comparison with another build. Retained control ROUND(0.5,0) returned 1 (0x3ff0000000000000). The selected archive row does not record its input plumbing; no input route is inferred.

Observed formulas and results
  • ROUND(0.5,0) → 1
    0x3ff0000000000000 (not-recorded)

Excel 16.0 build 20430

Windows, 64-bit, CPU not recorded

32,874 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. Retained control ROUND(817094511.6142203,6) returned 817094511.61422 (0x41c859efb7ce9ec3). The capture specifies exact-double bulk Value2 cell input.

Observed formulas and results
  • ROUND(817094511.6142203,6) → 817094511.61422
    0x41c859efb7ce9ec3 (cell-value2)

Alternatives

ROUNDDOWN truncates the decimal reading toward zero; ROUNDUP rounds it away from zero. MROUND chooses a multiple. INT floors negatives; TRUNC removes their fraction toward zero.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents