[gcalctool] Fix thousands separator being on front of three digit numbers
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcalctool] Fix thousands separator being on front of three digit numbers
- Date: Thu, 21 Apr 2011 08:08:34 +0000 (UTC)
commit d35eed9b499267818e9b311b2740f7d869ccb4ee
Author: Robert Ancell <robert ancell canonical com>
Date: Thu Apr 21 18:00:17 2011 +1000
Fix thousands separator being on front of three digit numbers
NEWS | 1 +
src/mp-serializer.c | 12 ++++++------
2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/NEWS b/NEWS
index 983898e..e014668 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ Overview of changes in gcalctool 6.1.0
* Support both μs and us for entering microseconds
* Fix order of implied multiplication
* Make automatic exponentiation less aggressive
+ * Fix thousands separator being on front of three digit numbers
Overview of changes in gcalctool 6.0.0
diff --git a/src/mp-serializer.c b/src/mp-serializer.c
index 501128a..4827432 100644
--- a/src/mp-serializer.c
+++ b/src/mp-serializer.c
@@ -88,6 +88,12 @@ mp_cast_to_string_real(MpSerializer *serializer, const MPNumber *x, int base, gb
MPNumber t, t2, t3;
int64_t d;
+ if (serializer->priv->base == 10 && serializer->priv->show_tsep && i == serializer->priv->tsep_count) {
+ g_string_prepend_unichar(string, serializer->priv->tsep);
+ i = 0;
+ }
+ i++;
+
mp_divide_integer(&temp, base, &t);
mp_floor(&t, &t);
mp_multiply_integer(&t, base, &t2);
@@ -98,12 +104,6 @@ mp_cast_to_string_real(MpSerializer *serializer, const MPNumber *x, int base, gb
g_string_prepend_c(string, d < 16 ? digits[d] : '?');
(*n_digits)++;
- i++;
- if (serializer->priv->base == 10 && serializer->priv->show_tsep && i == serializer->priv->tsep_count) {
- g_string_prepend_unichar(string, serializer->priv->tsep);
- i = 0;
- }
-
mp_set_from_mp(&t, &temp);
} while (!mp_is_zero(&temp));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]