ceill - Linux


Overview

ceill rounds up a number to the nearest integer towards positive infinity. It operates on both positive and negative numbers, always rounding away from zero.

Syntax

ceill [OPTION]... NUMBER...

Options/Flags

  • -e EXPRESSION or -m EXPRESSION: Evaluate EXPRESSION and round the result. Multiple options can be specified, and rounding is applied in the order they appear.

  • -l: Use long double precision for intermediate calculations.

  • -i: Default output is already integer, no rounding will be done.

  • –help: Print help and exit.

Examples

$ ceill 3.14
4
$ ceill 3.5
4
$ ceill -3.14
-3
$ ceill -3.5
-3
$ ceill -e '3.1 + 1.9'
5
$ ceill -m '3.1 + 1.9'
5
$ ceill -l 3.999999999999999
4

Common Issues

  • If no rounding is performed (e.g., rounding a whole number), ceill exits with an error.

Integration

ceill can be used in combination with other commands like bc to perform complex rounding tasks. For example:

echo "3.14" | bc -l | ceill
4

Related Commands

  • round: Rounds to the nearest integer.
  • floor: Rounds towards negative infinity.