bk: 643d0f321WzNkRDNEL3OHseXdQR9AA
Integrated patch from Brian Utterback. <hart@ntp.org>
* [Bug 2525] Turn on automake subdir-objects across the project. <hart@ntp.org>
* [Bug 2410] syslog an error message on panic exceeded. <brian.utterback@oracle.com>
+* Use correct rounding in mstolfp(). perlinger/hart
* M_ADDF should use u_int32. <hart@ntp.org>
* Only define tv_fmt_libbuf() if we will use it. <stenn@ntp.org>
* Use recv_buffer instead of the longer recv_space.X_recv_buffer. hart/stenn
lfp->l_uf |= q;
r -= q * 1000u;
- /* numerically, rounding should happen *after* the sign correction
- * but that would produce different bit patterns from the previous
- * implementation. (off-by-one in the fraction. Neglectible, but
- * messy to fix in the unit tests. So we stay with the slightly
- * suboptimal calculation...)
- */
- /* round */
- if (r >= 500)
- L_ADDUF(lfp, 1u);
/* fix sign */
if (neg)
L_NEG(lfp);
+ /* round */
+ if (r >= 500)
+ L_ADDF(lfp, (neg ? -1 : 1));
return 1;
}