This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Convert mantissa storage in mp_no to int
On Thu, Dec 20, 2012 at 08:41:41PM +0000, Joseph S. Myers wrote:
> It would be interesting to compare the performance of this code with the
> GMP-based code used in strtod and printf (which, for example, supports
> Karatsuba multiplication, although maybe the threshold involved means that
> isn't actually relevant for the cases used in libm).
I had plugged mpfr code to replace the libm mp stuff to see what it's
like and the result is an improvement of about 10 times. So we've got
a lot of ground to catch up.
> > I have verified that the testsuite runs clean after this change. Like
>
> For both 32-bit and 64-bit systems that use this code?
>
> > + long tmp = Z[k];
> > + for (i=i1,j=i2-1; i<i2; i++,j--) tmp += (long) X[i]*Y[j];
>
> This doesn't look right for systems with 32-bit long. I don't know if
> there are similar problems elsewhere in this code.
>
Thanks, that is wrong for 32-bit, I'll just use int64_t. That's the
only place that needs such casting up; multiplication is the only
place that has scope to overflow int. I'll fix that and post the
updated patch after testing.
Siddhesh