On Tue, 24 Jun 2014 17:16:08 +0200
Martti Kühne <mysatyre_AT_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 <dev_AT_frign.de>
Received on Tue Jun 24 2014 - 17:29:53 CEST