summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--menus.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/menus.c b/menus.c
index 3179abf..8d45e33 100644
--- a/menus.c
+++ b/menus.c
@@ -2520,8 +2520,10 @@ static void Submenu_Service_Encoder(int encoder_change)
}
/* get first digit of new number */
- gchar* new_string = g_strdup_printf (" %d %s", equivalent_integer, expon);
+ gchar* int_string = g_strdup_printf ("%d", equivalent_integer);
+ gchar* new_string = g_strdup_printf (" %c.%s%s", int_string[0], int_string+1, expon);
g_free (expon);
+ g_free (int_string);
/* put in sign if required */
if (Submenu_Value<0) {
@@ -2529,10 +2531,9 @@ static void Submenu_Service_Encoder(int encoder_change)
}
// "moves" fractional digits to rear, to make room for the decimal point
- sprintf(new_string+2, "%d", equivalent_integer);
- new_string[2]='.';
new_value=atof(new_string);
+
if (equivalent_integer>9999) {
new_value*=10;
}