* doc/lispref/numbers.texi (Integer Basics):
* doc/lispref/objects.texi (Integer Type, Equality Predicates):
Be clearer about eq vs eql vs = on bignums, floats, and strings.
* etc/NEWS: Rearrange and mark entries whether documented or not.
* doc/lispref/streams.texi (Output Variables): Document the new
default of 'print-quoted'.
* doc/lispref/keymaps.texi (Functions for Key Lookup): Document
that KEYMAP arg to 'lookup-key' can also be a list.
* doc/lispref/customize.texi (Variable Definitions): Document the
:local keyword of 'defcustom'.
* doc/lispref/numbers.texi (Float Basics): Document changes in
'logb'.
* doc/lispref/hooks.texi (Standard Hooks): Document
'comint-password-function'.
* doc/emacs/display.texi (Text Scale): Document text-size
adjustment using the mouse wheel.
* doc/emacs/frames.texi (Mouse Commands): Document image scaling
with the mouse wheel.
* doc/emacs/windows.texi (Window Convenience): Document
'global-tab-line-mode'.
* doc/emacs/search.texi (Repeat Isearch, Symbol Search)
(Isearch Yank): Document the new support for numeric arguments in
Isearch commands.
(Special Isearch): Document 'M-s M->' and 'M-s M-<'.
(Search Customizations): Document 'isearch-lazy-count'. Improve
indexing.
(Not Exiting Isearch): Document the new value of
'isearch-allow-scroll'.
* doc/emacs/maintaining.texi (Xref Commands): Document the new 'g'
key binding.
* doc/emacs/package.texi (Package Installation): Document changes
in 'package-check-signature'.
* doc/emacs/maintaining.texi (VC Change Log): Document
'vc-log-search'.
* doc/emacs/dired.texi (Operating on Files): Document
'dired-vc-rename'.
* doc/lispref/numbers.texi (Float Basics):
* doc/misc/cl.texi (Implementation Parameters):
* lisp/emacs-lisp/cl-lib.el (cl-most-positive-float)
(cl-least-positive-float)
(cl-least-positive-normalized-float, cl-float-epsilon)
(cl-float-negative-epsilon):
Document IEEE floating point better. Don’t suggest that Emacs
might use some floating-point format other than IEEE format, as
Emacs currently assumes IEEE in several places and there seems
little point in removing those assumptions.
Without this fix, Emacs can get into a tight loop reporting
a range error when calculating timestamps.
* doc/lispref/numbers.texi (Integer Basics):
* src/alloc.c (syms_of_alloc): Document this.
* src/bignum.c (make_bignum_bits): Always allow bignums
of at least twice the width of (u)intmax_t.
Change logb to return -infinity, +infinity, and NaN respectively.
Formerly logb returned an extreme fixnum to represent
infinity, but this is no longer the right thing to do now that
we have bignums and there is no extreme integer.
* doc/lispref/numbers.texi (Float Basics), etc/NEWS: Document.
* src/floatfns.c (Flogb): Implement this.
Also, since Emacs historically reported a range error when
rounding operations overflowed, do that consistently for all
bignum overflows.
* doc/lispref/errors.texi (Standard Errors):
* doc/lispref/numbers.texi (Integer Basics): Document range errors.
* src/alloc.c (range_error): Rename from integer_overflow.
All uses changed.
* src/floatfns.c (rounding_driver): When the result of a floating
point rounding operation does not fit into a fixnum, put it
into a bignum instead of always signaling an range error.
* test/src/floatfns-tests.el (divide-extreme-sign):
These tests now return the mathematically-correct answer
instead of signaling an error.
(bignum-round): Check that integers round to themselves.
libgmp calls ‘abort’ when given numbers too big for its
internal data structures. The numeric limit is large and
platform-dependent; with 64-bit GMP 6.1.2 it is around
2**2**37. Work around the problem by refusing to call libgmp
functions with arguments that would cause an abort. With luck
libgmp will have a better way to do this in the future.
Also, introduce a variable integer-width that lets the user
control how large bignums can be. This currently defaults
to 2**16, i.e., it allows bignums up to 2**2**16. This
should be enough for ordinary computation, and should
help Emacs to avoid thrashing or hanging.
Problem noted by Pip Cet (Bug#32463#71).
* doc/lispref/numbers.texi, etc/NEWS:
Document recent bignum changes, including this one.
Improve documentation for bitwise operations, in the light
of bignums.
* src/alloc.c (make_number): Enforce integer-width.
(integer_overflow): New function.
(xrealloc_for_gmp, xfree_for_gmp):
Move here from emacs.c, as it's memory allocation.
(init_alloc): Initialize GMP here, rather than in emacs.c.
(integer_width): New var.
* src/data.c (GMP_NLIMBS_MAX, NLIMBS_LIMIT): New constants.
(emacs_mpz_size, emacs_mpz_mul)
(emacs_mpz_mul_2exp, emacs_mpz_pow_ui): New functions.
(arith_driver, Fash, expt_integer): Use them.
(expt_integer): New function, containing integer code
that was out of place in floatfns.c.
(check_bignum_size, xmalloc_for_gmp): Remove.
* src/emacs.c (main): Do not initialize GMP here.
* src/floatfns.c (Fexpt): Use expt_integer, which
now contains integer code moved from here.
* src/lisp.h (GMP_NUMB_BITS): Define if gmp.h doesn’t.
Problem and initial solution reported by Andy Moreton in:
https://lists.gnu.org/r/emacs-devel/2018-08/msg00503.html
* doc/lispref/numbers.texi (Math Functions): expt integer
overflow no longer causes truncation; it now signals an error
since bignum overflow is a big deal.
* src/floatfns.c (Fexpt): Support bignum arguments.
* test/src/floatfns-tests.el (bignum-expt): New test.
* doc/lispref/numbers.texi (Bitwise Operations): Document that
the traditional (lsh A B) behavior is for fixnums, and that it
is an error if A and B are both negative and A is a bignum.
See Bug#32463.
* lisp/subr.el (lsh): New function, moved here from src/data.c.
* src/data.c (ash_lsh_impl): Remove, moving body into Fash
since it’s the only caller now.
(Fash): Check for out-of-range counts. If COUNT is zero,
return first argument instead of going through libgmp. Omit
lsh code since lsh is now done in Lisp. Add code for shifting
fixnums right, to avoid a round trip through libgmp.
(Flsh): Remove; moved to lisp/subr.el.
* test/lisp/international/ccl-tests.el (shift):
Test for traditional lsh behavior, instead of assuming
lsh is like ash when bignums are present.
* test/src/data-tests.el (data-tests-logand)
(data-tests-logior, data-tests-logxor, data-tests-ash-lsh):
New tests.
* etc/NEWS: Enhance the announcement of bignums.
* doc/lispref/numbers.texi (Integer Basics): Add a missing
period. Reported by Basil L. Contovounesios <contovob@tcd.ie>.
* configure.ac (HAVE_GMP): Rename ‘configure’ option from
--without-mini-gmp to --with-libgmp. All uses changed.
* doc/lispref/numbers.texi (Predicates on Numbers): Large
integers are always available. Clarify how eq works on them.
* doc/lispref/numbers.texi (Float Basics, Comparison of Numbers):
Improve documentation of ‘=’ vs ‘eq’, ‘eql’ and ‘equal’
when NaNs and signed zeros are involved.
Fix a bug where eql, sxhash-eql, memql, and make-hash-table
were not consistent on NaNs. Likewise for equal,
sxhash-equal, member, and make-hash-table. Some of these
functions ignored NaN significands, whereas others treated
them as significant. It's more logical to treat significands
as significant, and this typically makes eql a bit more
efficient on floats, with just one integer comparison instead
of one to three floating-point comparisons.
* doc/lispref/numbers.texi (Float Basics): Document that
NaNs are never numerically equal, but might be eql.
* src/fns.c (WORDS_PER_DOUBLE): Move to top level of this file.
(union double_and_words): Now named, and at the top level of this file.
(same_float): New function.
(Fmemql, Feql, internal_equal, cmpfn_eql): Use it, so that
the corresponding functions treat NaNs consistently.
(sxhash_float): Simplify based on above-mentioned changes.
* test/src/fns-tests.el (fns-tests-equality-nan): New test.
* doc/lispref/numbers.texi (Integer Basics): Clarify that
out-of-range integers are treated as floating point only when the
integers are decimal.
* etc/NEWS: Mention changes.
* src/editfns.c (styled_format): Use %.0f when formatting %d or %i
values outside machine integer range, to avoid losing info.
Signal an error for %o or %x values that are too large to be
formatted, to avoid losing info.
63b04c11d5 Fix copyright years by hand
5c7dd8a783 Update copyright year to 2018
220a9ecba1 Merge from Gnulib
312c565566 Don't add empty keyboard macro to macro ring (Bug#24992)
39ca289a7a Allow customization of decoding of "man" command
f8240815ea * etc/NEWS: Add security consideration note on passphrase ...
0c78822c70 Fix subtle problem with scroll-down when scroll-margin is ...
acd289c5a4 Fix problems with indexing in User manual
b240c7846b * lisp/help.el (describe-key): Only (copy-sequence elt) wh...
e879a5444a * src/buffer.c (Frestore_buffer_modified_p): Fix bug#29846
81b1028b63 Improve documentation of 'inhibit-modification-hooks' and ...
7175496d7a Fix doc string of 'enable-recursive-minibuffers'
5b38406491 Fix documentation of delsel and of killing text
# Conflicts:
# etc/NEWS
# etc/refcards/ru-refcard.tex
Behaving like Common Lisp is less likely to lead to surprises,
as it yields the same answers on 32- vs 64-bit machines.
* doc/lispref/numbers.texi (Bitwise Operations):
Document behavior on negative integers.
* src/data.c (Flogcount):
Behave like Common Lisp for negative arguments.
* test/src/data-tests.el (data-tests-popcnt)
(data-tests-logcount): Test negative args too.
* doc/lispref/numbers.texi (Comparison of Numbers):
* etc/NEWS: Document this.
* src/data.c (Amax, Amin): Remove constants. All uses removed.
(minmax_driver): New function.
(Fmax, Fmin): Use it instead of arith_driver.
* test/src/data-tests.el (data-tests-max, data-tests-min): New tests.
* configure.ac: Check for "/dev/urandom".
* src/sysdep.c (init_random) [HAVE_DEV_URANDOM]: Read the stream
for the seed from "/dev/urandom".
[WINDOWSNT]: Obtain the stream for the seed from w32 APIs.
* src/fns.c (Frandom): Update the doc string to indicate that
system entropy is used when available.
* src/w32.c: Include wincrypt.h.
(w32_init_crypt_random, w32_init_random): New functions, use the
CryptGenRandom API.
(globals_of_w32): Initialize w32_crypto_hprov handle to zero.
* src/w32.h (w32_init_random): Add prototype.
* doc/lispref/numbers.texi (Random Numbers): Document more details
about 't' as the argument to 'random'.
* etc/NEWS: Mention that '(random t)' now uses a cryptographically
strong seed if possible.
(Bug#22202)
This is more compatible with Common Lisp and XEmacs (Bug#21690). See:
http://lists.gnu.org/archive/html/emacs-devel/2015-10/msg01053.html
* lisp/color.el (color-hue-to-rgb, color-hsl-to-rgb)
(color-xyz-to-srgb, color-xyz-to-lab):
* lisp/emacs-lisp/cl-extra.el (cl-float-limits):
* lisp/net/shr-color.el (shr-color-hue-to-rgb)
(shr-color-hsl-to-rgb-fractions):
Exploit the change to simplify the code a bit.
* lisp/emacs-lisp/bytecomp.el (byte-compile-quo):
Don’t complain about single-argument calls to ‘/’.
* src/data.c (arith_driver, float_arith_driver):
Implement the change.
The manuals often used quotes ``...'' when it is better to use @dfn or
@code or capitalized words or no quoting at all. For example, there is
no need for the `` and '' in “if a variable has one effect for
@code{nil} values and another effect for ``non-@code{nil}'' values”.
Reword the Emacs, Lisp intro, and Lisp reference manuals to eliminate
unnecessary quoting like this, and to use @dfn etc. instead when called
for (Bug#21472).
* doc/lispref/numbers.texi (Float Basics): Improve ldexp documentation.
* src/floatfns.c (Fldexp): Require 2 args. Avoid undefined behavior
if the exponent is out of 'int' range. Improve documentation.
Fixes: bug#20185
* doc/lispref/numbers.texi (Numeric Conversions, Rounding Operations):
Document that 'round' and 'fround' round to even.
* src/floatfns.c (emacs_rint) [!HAVE_RINT]: Round to even.
This way, the unusual !HAVE_RINT case acts like the usual
HAVE_RINT case, and we can fix the documentation accordingly.
* numbers.texi (Numbers, Integer Basics, Float Basics):
Document the basics a bit more precisely. Say more clearly
that Emacs floating-point numbers are IEEE doubles on all
current platforms. Give more details about frexp.
Say more clearly that '1.' is an integer.
(Predicates on Numbers): Fix wholenump typo.
* objects.texi (Integer Type): Adjust to match numbers.texi.
* commands.texi, customize.texi, display.texi, elisp.texi, files.texi:
* frames.texi, hash.texi, internals.texi, keymaps.texi, lists.texi:
* minibuf.texi, nonascii.texi, numbers.texi, objects.texi, os.texi:
* processes.texi, streams.texi, strings.texi, text.texi:
* variables.texi, windows.texi:
Hyphenate "floating-point" iff it precedes a noun.
Reword to avoid nouns and hyphenation when that's easy.
Prefer "integer" to "integer number" and "is floating point"
to "is a floating point number".
Prefer "@minus{}" to "-" when it's a minus.