Re: [PATCH 2/3] lib/string_helpers.c: don't lose precision in string_get_size()

2015-10-27 Thread Andy Shevchenko
On Tue, 2015-10-27 at 09:36 +0100, Vitaly Kuznetsov wrote: > Andy Shevchenko writes: > > > On Mon, 2015-10-26 at 14:55 +0100, Vitaly Kuznetsov wrote: > > > string_get_size() loses precision when there is a remainder for > > > blk_size / divisor[units] and size is big enough. E.g > > > string_get_

Re: [PATCH 2/3] lib/string_helpers.c: don't lose precision in string_get_size()

2015-10-27 Thread Vitaly Kuznetsov
Rasmus Villemoes writes: > So I also played with this over the weekend, and also threw together a > stupid script to check the output. I see you have more or less the same > idea I used, namely to combine size and blk_size earlier. > > I put some code on github, https://github.com/Villemoes/get_s

Re: [PATCH 2/3] lib/string_helpers.c: don't lose precision in string_get_size()

2015-10-27 Thread Vitaly Kuznetsov
Andy Shevchenko writes: > On Mon, 2015-10-26 at 14:55 +0100, Vitaly Kuznetsov wrote: >> string_get_size() loses precision when there is a remainder for >> blk_size / divisor[units] and size is big enough. E.g >> string_get_size(8192, 4096, STRING_UNITS_10, ...) returns "32.7 MB" >> while it is su

Re: [PATCH 2/3] lib/string_helpers.c: don't lose precision in string_get_size()

2015-10-26 Thread Rasmus Villemoes
So I also played with this over the weekend, and also threw together a stupid script to check the output. I see you have more or less the same idea I used, namely to combine size and blk_size earlier. I put some code on github, https://github.com/Villemoes/get_size. All versions still fail a very

Re: [PATCH 2/3] lib/string_helpers.c: don't lose precision in string_get_size()

2015-10-26 Thread Andy Shevchenko
On Mon, 2015-10-26 at 14:55 +0100, Vitaly Kuznetsov wrote: > string_get_size() loses precision when there is a remainder for > blk_size / divisor[units] and size is big enough. E.g > string_get_size(8192, 4096, STRING_UNITS_10, ...) returns "32.7 MB" > while it is supposed to return "33.5 MB". For