This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/3] powerpc: POWER8 fmod optimization
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- Cc: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Wed, 12 Nov 2014 16:19:55 +0000
- Subject: Re: [PATCH 2/3] powerpc: POWER8 fmod optimization
- Authentication-results: sourceware.org; auth=none
- References: <54627990 dot 1060805 at linux dot vnet dot ibm dot com> <alpine dot DEB dot 2 dot 10 dot 1411112120500 dot 12642 at digraph dot polyomino dot org dot uk> <54637EFF dot 2040302 at linux dot vnet dot ibm dot com>
On Wed, 12 Nov 2014, Adhemerval Zanella wrote:
> Indeed I overlook it, as I am seeing now with a more extensive testing.
> Checking now, it seems using a FP division operation in the loop to
> correct it not the best strategy to achieve better performance.
And there are other problems with the division I didn't notice previously.
If the exponent difference is large enough, the division may overflow.
And you're assuming the result of (round to next integer toward 0 (divide
and round in current rounding mode)) is the same as (divide in infinite
precision, round once to an integer toward 0) - but depending on the
arguments and rounding mode, the result of the division may be rounded
away from 0 to an integer with magnitude greater than the desired result.
--
Joseph S. Myers
joseph@codesourcery.com