aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorPaul Eggert2018-08-22 19:30:24 -0700
committerPaul Eggert2018-08-22 19:30:57 -0700
commitee641b87cf220250ba89f219fb47a4406a05deb7 (patch)
tree08ff44c5197ae39b2ec0906de4bb4dcafda4677f /doc
parentbe5fe6183e95f3afe3a62ec43504b99df90bc794 (diff)
downloademacs-ee641b87cf220250ba89f219fb47a4406a05deb7.tar.gz
emacs-ee641b87cf220250ba89f219fb47a4406a05deb7.zip
Fix bugs when rounding to bignums
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.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/errors.texi8
-rw-r--r--doc/lispref/numbers.texi2
2 files changed, 6 insertions, 4 deletions
diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi
index a0e32c5631c..e61ea98e210 100644
--- a/doc/lispref/errors.texi
+++ b/doc/lispref/errors.texi
@@ -159,6 +159,11 @@ The message is @samp{No catch for tag}. @xref{Catch and Throw}.
159The message is @samp{Attempt to modify a protected file}. 159The message is @samp{Attempt to modify a protected file}.
160@end ignore 160@end ignore
161 161
162@item range-error
163The message is @code{Arithmetic range error}.
164This can happen with integers exceeding the @code{integer-width} limit.
165@xref{Integer Basics}.
166
162@item scan-error 167@item scan-error
163The message is @samp{Scan error}. This happens when certain 168The message is @samp{Scan error}. This happens when certain
164syntax-parsing functions find invalid syntax or mismatched 169syntax-parsing functions find invalid syntax or mismatched
@@ -223,9 +228,6 @@ The message is @samp{Arithmetic domain error}.
223The message is @samp{Arithmetic overflow error}. This is a subcategory 228The message is @samp{Arithmetic overflow error}. This is a subcategory
224of @code{domain-error}. 229of @code{domain-error}.
225 230
226@item range-error
227The message is @code{Arithmetic range error}.
228
229@item singularity-error 231@item singularity-error
230The message is @samp{Arithmetic singularity error}. This is a 232The message is @samp{Arithmetic singularity error}. This is a
231subcategory of @code{domain-error}. 233subcategory of @code{domain-error}.
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi
index a8150478613..d03113674f5 100644
--- a/doc/lispref/numbers.texi
+++ b/doc/lispref/numbers.texi
@@ -201,7 +201,7 @@ range are limited to absolute values less than
201@math{2^{n}}, 201@math{2^{n}},
202@end tex 202@end tex
203where @var{n} is this variable's value. Attempts to create bignums outside 203where @var{n} is this variable's value. Attempts to create bignums outside
204this range result in an integer overflow error. Setting this variable 204this range signal a range error. Setting this variable
205to zero disables creation of bignums; setting it to a large number can 205to zero disables creation of bignums; setting it to a large number can
206cause Emacs to consume large quantities of memory if a computation 206cause Emacs to consume large quantities of memory if a computation
207creates huge integers. 207creates huge integers.