summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/regexp-opt.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-08-16 16:25:02 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-08-16 16:27:27 -0700
commitf9fd12a30b3d94eb48f7b309907d136d7b2682ac (patch)
treed00aa93beec6eb1013127ee251342f39f135a994 /lisp/emacs-lisp/regexp-opt.el
parente82923c817159c751aa9c902093a46b9457e8499 (diff)
downloademacs-f9fd12a30b3d94eb48f7b309907d136d7b2682ac.tar.gz
emacs-f9fd12a30b3d94eb48f7b309907d136d7b2682ac.tar.bz2
emacs-f9fd12a30b3d94eb48f7b309907d136d7b2682ac.zip
Fix time-add rounding bug
Without this fix, time arithmetic yielded results that were not mathematically accurate, even though the exact results were representable; for example, (time-add 0 1e-13) yielded a timestamp equal to 0 instead of to 1e-13. * lisp/timezone.el (timezone-time-from-absolute): Let time-add do its thing rather than using floating point internally, which has rounding errors. We now have bignums and so don’t need floating point to avoid overflow issues. * src/timefns.c (timeform_sub_ps_p): New function. (time_arith): If either argument is a float, represent the result exactly instead of discarding sub-ps info. * test/lisp/timezone-tests.el (timezone-tests-time-from-absolute): Don’t assume (HI LO US PS) timestamp format. * test/src/emacs-module-tests.el (mod-test-add-nanosecond/valid): Don’t assume that time-add discards sub-ns info. * test/src/timefns-tests.el (time-rounding-tests): Add regression test to detect time-add rounding bug.
Diffstat (limited to 'lisp/emacs-lisp/regexp-opt.el')
0 files changed, 0 insertions, 0 deletions