RoundUp

RoundUp

RoundUp[ a ] rounds a number up to the nearest integer.

Usages

RoundUp[ a ]

RoundUp[ a ] rounds the value of a up to the nearest integer. a can be any expression with a numerical value, or a quantity with a unit. In a script, wrap the command in Simplify.

Example in out
A decimal number. Simplify[ RoundUp[1.2] ] 2
For negative numbers, rounding up goes towards zero. Simplify[ RoundUp[-1.2] ] -1
An integer stays the same. Simplify[ RoundUp[3] ] 3
An expression with a numerical value. Simplify[ RoundUp[Sqrt[2]] ] 2
A quantity keeps its unit. Simplify[ RoundUp[Quantity[1.2, 'm']] ] Quantity[2, 'm']
Details
  • Without Simplify, the command is not calculated: in a script, RoundUp[ 1.2 ] stays RoundUp[1.2]. To round up directly in a script, use Ceil.
  • Decimals: RoundUp always rounds to an integer. Simplify[ RoundUp[1.234, 2] ] is not calculated; use Ceil[ 1.234, 2 ] instead.
Invalid input Result
Simplify[ RoundUp[x] ] Not calculated: the argument must have a numerical value.

See also: RoundDown, Ceil, Round, Simplify