MathLib.ceil()

MathLib.ceil() returns the greatest integer smaller or equal the argument. \[ \text{MathLib.ceil}(x) = \lceil x \rceil \]

Specification

MathLib.ceil accepts one argument. Any additional arguments will be ignored. The type of the argument should be number. For other argument types see the unary function specification.
  1. MathLib.ceil(NaN) = NaN
  2. MathLib.ceil(+0) = +0
  3. MathLib.ceil(-0) = -0
  4. MathLib.ceil(+∞) = +∞
  5. MathLib.ceil(-∞) = -∞
  6. otherwise MathLib.ceil(x) = ⎡x⎤

Implementation

Due to a bug in some implementations where Math.ceil(-0) = +0 (and not -0), MathLib handles this special case separately. In all other cases the built-in JavaScript function Math.ceil is used.

Tests

Categories: unary Function