This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 04/28] powerpc: ceil/ceilf refactor
- From: "Gabriel F. T. Gomes" <gabriel at inconstante dot eti dot br>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: <libc-alpha at sourceware dot org>
- Date: Thu, 9 May 2019 16:56:34 -0300
- Subject: Re: [PATCH 04/28] powerpc: ceil/ceilf refactor
- References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> <20190329133529.22523-5-adhemerval.zanella@linaro.org> <20190425015655.c2wckfwowa4xboc4@tereshkova> <83c7cdd1-0042-fa33-36f4-93d732fedba0@linaro.org> <20190502184136.2d7xcc44zvcn5imo@tereshkova.br.ibm.com> <20190504214626.nnpt3ilkxr5pk3h2@tereshkova> <929ba131-65d3-a2ee-643c-9f503e28112b@linaro.org>
On Mon, May 06 2019, Adhemerval Zanella wrote:
>
> My understanding is the frsp was added to align the implementation to
> POSIX 2001 [1] description which contains a possible range error.
> However, as described by man-pages [2], this error for IEEE 754
> formats can not happen in practice (the maximum value of exponent for
> float, 2^127, is larger than maximum value by significand, 2^23).
I see, and the check (if (fabs (x) > 0x1p+23) return x), at the
beginning of the function, guarantees that an overflow is never caused
by the following addition and subtraction (or vice versa) of 2^23.
Thanks for the clarification.
> This was in fact corrected by both C99 and POSIX 2008 [3] by removing
> the possible return error. So, as gcc builtin implements, the frsp
> is superfluous.
>
> [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/ceil.html
> [2] http://man7.org/linux/man-pages/man3/ceil.3.html
> [3] https://pubs.opengroup.org/onlinepubs/9699919799/functions/ceil.html
Thanks for the references, too.