diff options
| author | Paul Eggert | 2019-11-13 13:07:01 -0800 |
|---|---|---|
| committer | Paul Eggert | 2019-11-13 13:10:09 -0800 |
| commit | bede5984246ba734c93fc28148b5f8e1b14d30c5 (patch) | |
| tree | d5ec0482e1ed6b8dad42e65c9d9ea4eb2e2b75ff /test/src | |
| parent | 02e637ecca3b1419d2a6c433eca72c5728c65051 (diff) | |
| download | emacs-bede5984246ba734c93fc28148b5f8e1b14d30c5.tar.gz emacs-bede5984246ba734c93fc28148b5f8e1b14d30c5.zip | |
Fix double-rounding bug in ceiling etc.
This is doable now that we have bignums.
* src/floatfns.c (integer_value): Remove; no longer used.
(rescale_for_division): New function.
(rounding_driver): Use it to divide properly (by using bignums)
even when arguments are float, fixing a double-rounding FIXME.
* src/lisp.h (LOG2_FLT_RADIX): Move here ...
* src/timefns.c (frac_to_double): ... from here.
* test/src/floatfns-tests.el (big-round):
Add a test to catch the double-rounding bug.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/floatfns-tests.el | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/src/floatfns-tests.el b/test/src/floatfns-tests.el index 62201a877d0..7f1d4691bf0 100644 --- a/test/src/floatfns-tests.el +++ b/test/src/floatfns-tests.el | |||
| @@ -122,6 +122,8 @@ | |||
| 122 | 122 | ||
| 123 | (ert-deftest big-round () | 123 | (ert-deftest big-round () |
| 124 | (should (= (floor 54043195528445955 3) | 124 | (should (= (floor 54043195528445955 3) |
| 125 | (floor 54043195528445955 3.0)))) | 125 | (floor 54043195528445955 3.0))) |
| 126 | (should (= (floor 1.7976931348623157e+308 5e-324) | ||
| 127 | (ash (1- (ash 1 53)) 2045)))) | ||
| 126 | 128 | ||
| 127 | (provide 'floatfns-tests) | 129 | (provide 'floatfns-tests) |