|
From: David H. <dmh...@ma...> - 2007-04-27 02:35:31
|
On Apr 26, 2007, at 9:38 PM, William Hart wrote: > Well, my trick works. But it comes at a cost. > > I initially set it up to replace all the sign limbs > with sign*x (since the sign is always +/-1 or 0, no > actual multiplication actually needs to be performed). > The idea is to multiply the signs by the appropriate > amount so that when the division occurs the signs > return to what they should be. > > Well this works for positive signs, but of course it > fails for negative signs, since you'd have to be doing > a signed division, which you are not. Another possibility --- I think --- is to replace the -1 sign limb with -x, and then also decrement the next limb along. (i.e. you would have to use mpn_sub_1, to propagate any borrows, which is annoying.) Then if you divide by x, I think you get what you want. I'm not sure if it will be faster though. david |