diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-07-08 08:09:31 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-07-08 08:11:57 -0700 |
commit | 67fc55d6363390d0f3d4a28accd91c1cef915f44 (patch) | |
tree | b9afa8116201621ea8a2482fd362bed7724d0667 | |
parent | 95955e6746e847a366143121a8d0a61404cc740e (diff) | |
download | coreutils-67fc55d6363390d0f3d4a28accd91c1cef915f44.tar.gz |
doc: mention expr and factor bignums
* NEWS:
* doc/coreutils.texi (expr invocation, factor invocation):
Mention bignum support on all platforms. Modernize timings.
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | doc/coreutils.texi | 26 |
2 files changed, 16 insertions, 16 deletions
@@ -27,8 +27,10 @@ GNU coreutils NEWS -*- outline -*- ** New Features - ls --classify now supports the "always", "auto", or "never" flags, - to support only outputting classifier characters if connected to a tty. + expr and factor now support bignums on all platforms. + + ls --classify now supports the "always", "auto", or "never" flags, + to support only outputting classifier characters if connected to a tty. ** Improvements diff --git a/doc/coreutils.texi b/doc/coreutils.texi index c072b1575..6ec1e6c31 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -3596,7 +3596,7 @@ Use @var{prefix} as the output file name prefix. Use @var{format} as the output file name suffix. When this option is specified, the suffix string must include exactly one @code{printf(3)}-style conversion specification, possibly including -format specification flags, a field width, a precision specifications, +format specification flags, a field width, a precision specification, or all of these kinds of modifiers. The format letter must convert a binary unsigned integer argument to readable form. The format letters @samp{d} and @samp{i} are aliases for @samp{u}, and the @@ -13484,9 +13484,8 @@ may be used for grouping in the usual manner. You must quote parentheses and many operators to avoid the shell evaluating them, however. -When built with support for the GNU MP library, @command{expr} uses -arbitrary-precision arithmetic; otherwise, it uses native arithmetic -types and may fail due to arithmetic overflow. +Because @command{expr} uses multiple-precision arithmetic, it works +with integers wider than those of machine registers. The only options are @option{--help} and @option{--version}. @xref{Common options}. Options must precede operands. @@ -18370,32 +18369,31 @@ processing. @end table Factoring the product of the eighth and ninth Mersenne primes -takes about 30 milliseconds of CPU time on a 2.2 GHz Athlon. +takes about 4 milliseconds of CPU time on an Intel Xeon Silver 4116. @example M8=$(echo 2^31-1|bc) M9=$(echo 2^61-1|bc) n=$(echo "$M8 * $M9" | bc) -/usr/bin/time -f %U factor $n +bash -c "time factor $n" 4951760154835678088235319297: 2147483647 2305843009213693951 -0.03 + +real 0m0.004s +user 0m0.004s +sys 0m0.000s @end example Similarly, factoring the eighth Fermat number @math{2^{256}+1} takes -about 20 seconds on the same machine. +about 14 seconds on the same machine. +The single-precision code uses an algorithm +designed for factoring smaller numbers. Factoring large numbers is, in general, hard. The Pollard-Brent rho algorithm used by @command{factor} is particularly effective for numbers with relatively small factors. If you wish to factor large numbers which do not have small factors (for example, numbers which are the product of two large primes), other methods are far better. -If @command{factor} is built without using GNU MP, only -single-precision arithmetic is available, and so large numbers -(typically @math{2^{128}} and above) will not be supported. -The single-precision code uses an algorithm which is designed -for factoring smaller numbers. - @exitstatus |