[gnome-color-manager] Make the cm to inches calulation more robust



commit e4c93a2e138b8be51cf291a492bb0c4d37ae549e
Author: Richard Hughes <richard hughsie com>
Date:   Wed Dec 2 11:44:56 2009 +0000

    Make the cm to inches calulation more robust

 src/gcm-client.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/gcm-client.c b/src/gcm-client.c
index af68a5a..9126d3a 100644
--- a/src/gcm-client.c
+++ b/src/gcm-client.c
@@ -399,13 +399,13 @@ out:
 
 	/* append size if available */
 	if (width != 0 && height != 0) {
-		guint diag;
+		gfloat diag;
 
 		/* calculate the dialgonal using Pythagorean theorem */
 		diag = sqrtf ((powf (width,2)) + (powf (height, 2)));
 
 		/* print it in inches */
-		g_string_append_printf (string, " - %i\"", (guint) ((gfloat) diag * 0.393700787f));
+		g_string_append_printf (string, " - %i\"", (guint) ((diag * 0.393700787f) + 0.5f));
 	}
 
 	g_free (name);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]