1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-27 15:52:00 -08:00
emacs/test/src
Paul Eggert af82a6248c Fix rounding errors with float timestamps
When converting from float to (TICKS . HZ) form, do the
conversion exactly.  When converting from (TICKS . HZ) form to
float, round to even precisely.  This way, successfully
converting a float to (TICKS . HZ) and back yields a value
numerically equal to the original.
* src/timefns.c (flt_radix_power_size): New constant.
(flt_radix_power): New static var.
(decode_float_time): Convert the exact numeric value rather
than guessing TIMESPEC_HZ resolution.
(s_ns_to_double): Remove; no longer needed.
(frac_to_double): New function.
(decode_ticks_hz): It is now the caller’s responsibility to
pass a valid TICKS and HZ.  All callers changed.
Use frac_to_double to round (TICKS . HZ) precisely.
(decode_time_components): When decoding nil, use
decode_ticks_hz since it rounds precisely.
(syms_of_timefns): Initialize flt_radix_power.
* test/src/timefns-tests.el (float-time-precision): New test.
2019-08-15 10:41:40 -07:00
..
regex-resources
alloc-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
buffer-tests.el Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
callint-tests.el Update more copyright years 2018-12-31 18:47:22 -08:00
callproc-tests.el Minor change in a comment 2019-04-15 19:11:16 +03:00
casefiddle-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
charset-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
chartab-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
cmds-tests.el forward-line now works with bignums 2019-01-27 15:52:06 -08:00
coding-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
data-tests.el Merge from origin/emacs-26 2019-02-15 13:25:30 -08:00
decompress-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
doc-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
editfns-tests.el Support "%x" etc. formats on more floats 2019-07-23 01:46:41 -07:00
emacs-module-tests.el Port mod-test-nanoseconds to 32-bit Emacs 2019-08-15 02:06:34 -07:00
eval-tests.el Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
fileio-tests.el Fix recently-introduced file-name-absolute-p typo 2019-07-26 09:48:57 -07:00
floatfns-tests.el Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
fns-tests.el Fix crash if user test munges hash table 2019-07-20 20:13:46 -07:00
font-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
inotify-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
json-tests.el * test/src/json-tests.el (json-serialize/object): Fix spacing. 2019-06-29 07:41:52 +02:00
keyboard-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
keymap-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
lcms-tests.el Go back to "Maintainer: emacs-devel@gnu.org" 2019-05-25 14:25:18 -07:00
lread-tests.el Make warning about unescaped character literals more helpful. 2019-04-19 19:19:35 +02:00
marker-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
minibuf-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
print-tests.el Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
process-tests.el Merge from origin/emacs-26 2019-07-30 21:42:34 -07:00
regex-emacs-tests.el Correct regexp matching of raw bytes 2019-06-28 17:30:18 +02:00
syntax-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
textprop-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00
thread-tests.el Remove failing test erroneously added in backport 2019-06-14 09:40:40 +03:00
timefns-tests.el Fix rounding errors with float timestamps 2019-08-15 10:41:40 -07:00
undo-tests.el Suppress interactive-only warnings in undo-tests.el (Bug#36565) 2019-08-08 08:26:31 -04:00
xml-tests.el Update copyright year to 2019 2019-01-01 01:01:13 +00:00