[gcalctool] Don't use exponential form with exponent 0



commit e621b50417df1bfa96724adae4852061440527c5
Author: Robert Ancell <robert ancell gmail com>
Date:   Thu Apr 22 19:06:58 2010 +1000

    Don't use exponential form with exponent 0

 src/mp-convert.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/mp-convert.c b/src/mp-convert.c
index 90c5f0a..a48e0f4 100644
--- a/src/mp-convert.c
+++ b/src/mp-convert.c
@@ -687,14 +687,16 @@ mp_cast_to_exponential_string(const MPNumber *x, int default_base, int base_, in
 
     mp_cast_to_string(&mantissa, default_base, base_, max_digits, trim_zeroes, fixed, 1024);
     g_string_append(string, fixed);
-    g_string_append_printf(string, "Ã?10");
-    if (exponent < 0) {
-        exponent = -exponent;
-        g_string_append(string, "â?»");
-    }
-    snprintf(fixed, 1024, "%d", exponent);
-    for (c = fixed; *c; c++)
-        g_string_append(string, super_digits[*c - '0']);
+    if (exponent != 0) {
+        g_string_append_printf(string, "Ã?10");
+        if (exponent < 0) {
+            exponent = -exponent;
+            g_string_append(string, "â?»");
+        }
+        snprintf(fixed, 1024, "%d", exponent);
+        for (c = fixed; *c; c++)
+            g_string_append(string, super_digits[*c - '0']);
+    }
 
     strncpy(buffer, string->str, buffer_length);
     g_string_free(string, TRUE);



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