• Paul Eggert's avatar
    Fix rounding errors in time conversion · 5e229f88
    Paul Eggert authored
    * 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.
    5e229f88
timefns.c 62.6 KB