Re: [AD] fixceil() weirdness

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> Why does fixceil() set errno if the argument is bigger than 32767? 32768
> certainly fits in an int. Is this a mistake or was it made deliberately
> for some reason?

IMHO this fixceil() function implements a wobbly solution because it sets
errno when the return value can not fit in the "semantics" return type (an
int that can be represented by a fixed) and not when the return value can
not fit in the actual return type.

A contrario, the ANSI ceil() function doesn't set errno if its result (which
is a double representing an int) doesn't fit in an int:
    (int) ceil(2147483647.1) = -2147483648, errno = 0.

So I'm ok to modify this behaviour, provided that the change is recorded in
api._tx.

--
Eric Botcazou
ebotcazou@xxxxxxxxxx



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/