]> git.eshelyaron.com Git - emacs.git/commit
Fix rounding errors in time conversion
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 3 Mar 2020 18:17:34 +0000 (10:17 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 3 Mar 2020 18:20:32 +0000 (10:20 -0800)
commit5e229f88f946c9c246966defeb629965f65d9549
tree0eedf03cacff22c2cc3663975fe440be7d8c5a5b
parentb28b7382e330621986c50c65a8285e7770b28bc4
Fix rounding errors in time conversion

* src/timefns.c (frac_to_double): Pass FLT_RADIX to mpz_sizeinbase
instead of doing the radix calculation ourselves, not always
correctly.  Fix off-by-one error in scale, which caused
double-rounding.
(decode_time_components): Use frac_to_double (via decode_ticks_hz)
to fix double-rounding error that can occur even though
intermediate results are long double.
* test/src/timefns-tests.el (float-time-precision):
Test the above fixes.
src/timefns.c
test/src/timefns-tests.el