ceil

Returns the value of x rounded upward to the next integer (toward positive infinity).

  1. real ceil(real x)
  2. double ceil(double x)
    @trusted pure nothrow @nogc
    double
    ceil
    (
    double x
    )
  3. float ceil(float x)

Examples

import std.math.traits : isNaN;

assert(ceil(+123.456L) == +124);
assert(ceil(-123.456L) == -123);
assert(ceil(-1.234L) == -1);
assert(ceil(-0.123L) == 0);
assert(ceil(0.0L) == 0);
assert(ceil(+0.123L) == 1);
assert(ceil(+1.234L) == 2);
assert(ceil(real.infinity) == real.infinity);
assert(isNaN(ceil(real.nan)));
assert(isNaN(ceil(real.init)));

Meta