From 7d926a37cc8956753d610140fc301b845e3a7de9 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Sun, 2 May 2010 21:39:22 -0400 Subject: [PATCH] Do a better job of rounding in lgl_str_format_fraction(). When a number is determined to be "close enough" to being an integer, don't just simply cast the number to get the integer value. --- libglabels/str.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libglabels/str.c b/libglabels/str.c index a3236275..b0b71452 100644 --- a/libglabels/str.c +++ b/libglabels/str.c @@ -249,7 +249,7 @@ lgl_str_format_fraction (gdouble x) } if ( denom[i] == 1.0 ) { /* Simple integer. */ - return g_strdup_printf ("%d", (gint)x); + return g_strdup_printf ("%.0g", x); } n = (gint)( x * denom[i] + 0.5 ); d = (gint)denom[i]; -- 2.39.5