Re: [dev] [st] [PATCH] Explicit cast in CEIL macro

From: FRIGN <dev_AT_frign.de>
Date: Tue, 24 Jun 2014 17:03:19 +0200

On Tue, 24 Jun 2014 09:46:33 -0500
Eric Pruitt <eric.pruitt_AT_gmail.com> wrote:

> CEIL(x) ((int)(x) + ((x) > 0))
>
> Perhaps I'm missing something here, but this completely fails whenever
> (x) is already a whole number; CEIL(3.0) => 4.0 which is not the correct
> behaviour.

Damn, you are right -.-. Back to the drawing board.

CEIL(x) ((int)(x) + ((x) > 0 && (int)(x) != (x)))

I couldn't come up with a better one. Maybe you do.

Cheers

FRIGN

-- 
FRIGN <dev_AT_frign.de>
Received on Tue Jun 24 2014 - 17:03:19 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 24 2014 - 17:12:06 CEST