From 0a389691dcf9a31bb0da26089febb0bdd93545d7 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Thu, 3 Sep 2015 22:51:15 +0200
Subject: [PATCH] cleanup: avoid printing -0.00

Nice trick to not print -0.00 for some percent values.
---
 libdm/libdm-report.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 2ebb69e1a..6416f18d8 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -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)