diff options
| author | Paul Eggert | 2017-03-03 09:17:51 -0800 |
|---|---|---|
| committer | Paul Eggert | 2017-03-03 09:19:08 -0800 |
| commit | 74f87fd111904e5156727c72590d6fc4f67e8366 (patch) | |
| tree | f6802878c5105def6d6889d5b8f71e4fe9285b79 /test/src | |
| parent | f1fe3fcfc568c1527714ff3a95e678816e2787d4 (diff) | |
| download | emacs-74f87fd111904e5156727c72590d6fc4f67e8366.tar.gz emacs-74f87fd111904e5156727c72590d6fc4f67e8366.zip | |
logb now works correctly on large integers
* admin/merge-gnulib (GNULIB_MODULES): Add count-leading-zeros.
* etc/NEWS: Document the change.
* lib/count-leading-zeros.c, lib/count-leading-zeros.h:
* m4/count-leading-zeros.m4: New files, copied from Gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* src/floatfns.c: Include count-leading-zeros.h.
(Flogb): Do not convert fixnum to float before taking the log,
as the rounding error can cause the answer to be off by 1.
* src/lisp.h (EMACS_UINT_WIDTH): New constant.
* test/src/floatfns-tests.el (logb-extreme-fixnum): New test.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/floatfns-tests.el | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/src/floatfns-tests.el b/test/src/floatfns-tests.el index a2116a59459..448d6167f25 100644 --- a/test/src/floatfns-tests.el +++ b/test/src/floatfns-tests.el | |||
| @@ -25,4 +25,7 @@ | |||
| 25 | (should-error (round most-negative-fixnum -1.0)) | 25 | (should-error (round most-negative-fixnum -1.0)) |
| 26 | (should-error (truncate most-negative-fixnum -1.0))) | 26 | (should-error (truncate most-negative-fixnum -1.0))) |
| 27 | 27 | ||
| 28 | (ert-deftest logb-extreme-fixnum () | ||
| 29 | (should (= (logb most-negative-fixnum) (1+ (logb most-positive-fixnum))))) | ||
| 30 | |||
| 28 | (provide 'floatfns-tests) | 31 | (provide 'floatfns-tests) |