This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 04/28] powerpc: ceil/ceilf refactor


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]