1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cleanup: avoid printing -0.00

Nice trick to not print -0.00 for some percent values.
This commit is contained in:
Zdenek Kabelac 2015-09-03 22:51:15 +02:00
parent 32d6ca9196
commit 0a389691dc

View File

@ -2309,7 +2309,8 @@ static const char *_get_reserved(struct dm_report *rh, unsigned type,
float dm_percent_to_float(dm_percent_t percent)
{
return (float) percent / DM_PERCENT_1;
/* Add 0.f to prevent returning -0.00 */
return (float) percent / DM_PERCENT_1 + 0.f;
}
dm_percent_t dm_make_percent(uint64_t numerator, uint64_t denominator)