> On Jan. 5, 2018, 2:14 p.m., Joseph Wu wrote: > > 3rdparty/stout/include/stout/duration.hpp > > Lines 173 (patched) > > <https://reviews.apache.org/r/64729/diff/2/?file=1932982#file1932982line173> > > > > Why sacrifice the precision of integer * integer multiplication? > > > > ``` > > nanos = nanos * multiplier; > > ``` > > (You might need to `friend` one of these operators to get this to work) > > > > Same with the other operator. > > Andrew Schwartzmeyer wrote: > I'm not sacrificing it because we didn't have it to begin with: > > ``` > Duration operator*(double multiplier) const > { > Duration product = *this; > product *= multiplier; > return product; > } > ``` > > Where are you seeing a `Duration operator*(int multiplier)`?
I filed [MESOS-8421](https://issues.apache.org/jira/browse/MESOS-8421) for fixing the precision loss of the `Duration` operators. - Andrew ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/64729/#review194909 ----------------------------------------------------------- On Jan. 5, 2018, 1:53 p.m., Andrew Schwartzmeyer wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/64729/ > ----------------------------------------------------------- > > (Updated Jan. 5, 2018, 1:53 p.m.) > > > Review request for mesos, Greg Mann, Jie Yu, Joseph Wu, and Michael Park. > > > Repository: mesos > > > Description > ------- > > Without this change, every use of `Duration * 2` throws a conversion > warning because we multiple `Duration` by `int` and `size_t` without > casting to `double` (the type accepted by the actual implementation of > `operator*`). > > > Diffs > ----- > > 3rdparty/stout/include/stout/duration.hpp > d10b6a4d4d1a0096334c30fdec725ecc55c9f0ea > > > Diff: https://reviews.apache.org/r/64729/diff/3/ > > > Testing > ------- > > > Thanks, > > Andrew Schwartzmeyer > >