> On Dec. 20, 2017, 10:25 p.m., Benjamin Mahler wrote: > > 3rdparty/stout/include/stout/bytes.hpp > > Lines 82-85 (original), 82-85 (patched) > > <https://reviews.apache.org/r/64754/diff/1/?file=1925702#file1925702line82> > > > > I'm not so sure we need these at all, is it possible to remove them? > > > > Doubles are a little concerning, since there is a base unit of bytes > > involved here but doubles can represent values smaller than a single byte? > > E.g. 1.0000000001 kilobytes
It seems to me that we don't have such a problem because the constructor of `Bytes` always takes a `uint64_t`, so `Bytes` does not provide such a semantics. I'm using these helper functions because CSI uses bytes but our `Resource` protobuf uses double, so I need to either use the helper or do my own unit conversion. Would you prefer the latter? - Chun-Hung ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/64754/#review194277 ----------------------------------------------------------- On Dec. 20, 2017, 10:13 p.m., Chun-Hung Hsiao wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/64754/ > ----------------------------------------------------------- > > (Updated Dec. 20, 2017, 10:13 p.m.) > > > Review request for mesos, Benjamin Bannier, Benjamin Mahler, Jie Yu, and > Vinod Kone. > > > Repository: mesos > > > Description > ------- > > This patch makes `kilobytes()`, `megabytes()`, `gigabytes()` and > `terabytes()` return doubles to keep the precisions. > > NOTE: In the Mesos codebase, the returned values of these helper > functions except for the ones in the tests and SLRPs are used in the > following 3 ways: > > 1. Comparing with some constant value. > 2. Stringified as part of a log message. > 3. Stringified then onsumed by `Resources::parse()`, which will do fixed > point normalization. > > In all cases, the changes introduced in this patch should make no harm, > but just make the result more accurate. > > > Diffs > ----- > > 3rdparty/stout/include/stout/bytes.hpp > cbe953662bb86c2f1eef3453f557ea17c0c6d13e > > > Diff: https://reviews.apache.org/r/64754/diff/1/ > > > Testing > ------- > > See later in chain. > > > Thanks, > > Chun-Hung Hsiao > >