diff options
| author | Paul Eggert | 2018-08-22 19:30:24 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-08-22 19:30:57 -0700 |
| commit | ee641b87cf220250ba89f219fb47a4406a05deb7 (patch) | |
| tree | 08ff44c5197ae39b2ec0906de4bb4dcafda4677f /doc | |
| parent | be5fe6183e95f3afe3a62ec43504b99df90bc794 (diff) | |
| download | emacs-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.texi | 8 | ||||
| -rw-r--r-- | doc/lispref/numbers.texi | 2 |
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}. | |||
| 159 | The message is @samp{Attempt to modify a protected file}. | 159 | The message is @samp{Attempt to modify a protected file}. |
| 160 | @end ignore | 160 | @end ignore |
| 161 | 161 | ||
| 162 | @item range-error | ||
| 163 | The message is @code{Arithmetic range error}. | ||
| 164 | This can happen with integers exceeding the @code{integer-width} limit. | ||
| 165 | @xref{Integer Basics}. | ||
| 166 | |||
| 162 | @item scan-error | 167 | @item scan-error |
| 163 | The message is @samp{Scan error}. This happens when certain | 168 | The message is @samp{Scan error}. This happens when certain |
| 164 | syntax-parsing functions find invalid syntax or mismatched | 169 | syntax-parsing functions find invalid syntax or mismatched |
| @@ -223,9 +228,6 @@ The message is @samp{Arithmetic domain error}. | |||
| 223 | The message is @samp{Arithmetic overflow error}. This is a subcategory | 228 | The message is @samp{Arithmetic overflow error}. This is a subcategory |
| 224 | of @code{domain-error}. | 229 | of @code{domain-error}. |
| 225 | 230 | ||
| 226 | @item range-error | ||
| 227 | The message is @code{Arithmetic range error}. | ||
| 228 | |||
| 229 | @item singularity-error | 231 | @item singularity-error |
| 230 | The message is @samp{Arithmetic singularity error}. This is a | 232 | The message is @samp{Arithmetic singularity error}. This is a |
| 231 | subcategory of @code{domain-error}. | 233 | subcategory 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 |
| 203 | where @var{n} is this variable's value. Attempts to create bignums outside | 203 | where @var{n} is this variable's value. Attempts to create bignums outside |
| 204 | this range result in an integer overflow error. Setting this variable | 204 | this range signal a range error. Setting this variable |
| 205 | to zero disables creation of bignums; setting it to a large number can | 205 | to zero disables creation of bignums; setting it to a large number can |
| 206 | cause Emacs to consume large quantities of memory if a computation | 206 | cause Emacs to consume large quantities of memory if a computation |
| 207 | creates huge integers. | 207 | creates huge integers. |