mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-21 11:16:16 +02:00
factor: switch from mp to single when doable
This significantly improves performance when a number exceeds 2**(W_TYPE_SIZE - 1) and is the product of a prime less than FIRST_OMITTED_PRIME and another prime less than 2**(W_TYPE_SIZE - 1). On my platform, for example, it doubled the speed of factoring 4999 * (2**128 - 159). * src/factor.c (mp_size, mp_finish_in_single): New functions. (mp_factor_using_division, mp_factor_using_pollard_rho): Finish using single precision when possible. * tests/factor/factor.pl (lt-5000-times-128-bit): New test.
This commit is contained in:
@@ -92,6 +92,9 @@ my @Tests =
|
||||
['bug-with-128-bit-uintmax_t',
|
||||
'340282366920938463463374607431768211355',
|
||||
{OUT => '5 31 2195370109167344925570158757624311041'}],
|
||||
['lt-5000-times-128-bit',
|
||||
'1701071552237771378853409662551409288273703',
|
||||
{OUT => '4999 340282366920938463463374607431768211297'}],
|
||||
['h-1', '-h 3000', {OUT => '2^3 3 5^3'}],
|
||||
['h-2', '3000 --exponents', {OUT => '2^3 3 5^3'}],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user