]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
doc: mention expr and factor bignums
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 8 Jul 2020 15:09:31 +0000 (08:09 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 8 Jul 2020 15:11:57 +0000 (08:11 -0700)
* NEWS:
* doc/coreutils.texi (expr invocation, factor invocation):
Mention bignum support on all platforms.  Modernize timings.

NEWS
doc/coreutils.texi

diff --git a/NEWS b/NEWS
index 1c3f6378d642c248a6803ca83c7c44855f19989b..1881de1158cf186f3b67acc7559e582fb99d0c0b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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
 
index c072b15758fff580b40ffd719f79aad086b3ac43..6ec1e6c314bbe4f59ede9f62b5dd4a915ffcf8db 100644 (file)
@@ -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