mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
doc: mention expr and factor bignums
* NEWS: * doc/coreutils.texi (expr invocation, factor invocation): Mention bignum support on all platforms. Modernize timings.
This commit is contained in:
1 parent
95955e6746
commit
67fc55d636
2 files changed
+16
-16
No files matched your search
@@ -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
|
||||
|
||||
|
||||
+12
-14
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user