On Tue, 24 Jun 2014 17:16:08 +0200 Martti Kühne <mysat...@gmail.com> wrote:
> #define CEIL(x) ((int)(x) + ((int)(x) > 0) * ((x - (int)(x)) > FLT_EPSILON)) FLT_EPSILON is very smart. I'll not withdraw your nomination for the award. However, why * and not &&? The latter would stop at x > 0 and not do the diff-check in case x < 0. Moreover, (x) > 0 is needed, as (int)(x) > 0 wouldn't handle 0.xf properly. CEIL(x) ((int)(x) + ((x) > 0 && ((x) - (int)(x)) > FLT_EPSILON)) Cheers FRIGN -- FRIGN <d...@frign.de>