On Tue, Jun 24, 2014 at 8:50 AM, Roberto E. Vargas Caballero <k...@shike2.com> wrote: > CEIL(x) ((int) (x) + ((x) > 0 ? 1.0 : 0.0)) > > Positive: > CEIL(3.3) => 3 + (3.3 > 0 ? 1.0 : 0.0) => 4.0 > > Negative: > CEIL(-3.3) => -3 + (-3.3 > 0 ? 1.0 : 0.0) => -3 >
here's a shorter equivalent: #define CEIL(x) ((int)(x) + ((x) > 0)) cheers! mar77i