On Sat, 2018-03-03 at 22:49 +0200, Konstantin Belousov wrote:
> On Sat, Mar 03, 2018 at 12:14:42PM -0700, Ian Lepore wrote:
> > 
> > To really avoid roundoff errors, use mstosbt(ms) instead of SBT_1MS*ms.
> > 
> > The rounding errors when multiplying or dividing by SBT_1MS is not
> > severe like it is with SBT_1NS, but the inline functions still do the
> > arithmetic more correctly to avoid roundoff error.
> BTW mstosbt() and other functions have weird bracing in the formula. I
> think that the formula as calculated by the C operator precedence is
> fine, i.e. multiplication is done before right shift. But the bracing
> is redundand then, because the '()' pair next to the return () braces by
> inclusion is tautological.

Yeah, I noticed earlier today there is an extra set of parens.  I think
I might have copied the code from being a multi-line expression to
being all in the return and just pasted it without removing the extra
parens.

In general, I prefer extra parens instead of relying on knowledge of
operator precedence, but it makes no sense for the outermost layer of
parens.

-- Ian
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to