summaryrefslogtreecommitdiff
path: root/amount.cc
diff options
context:
space:
mode:
Diffstat (limited to 'amount.cc')
-rw-r--r--amount.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/amount.cc b/amount.cc
index 3217c698..3b6a8866 100644
--- a/amount.cc
+++ b/amount.cc
@@ -532,14 +532,6 @@ static commodity * parse_amount(mpz_t out, const char * num,
result = pcre_copy_substring(num, ovector, matched, base + 3, buf, 255);
assert(result >= 0);
- // Determine the precision used
- if (char * p = std::strchr(buf, '.'))
- precision = std::strlen(++p);
- else if (char * p = std::strchr(buf, '/'))
- precision = std::strlen(++p) - 1;
- else
- precision = 0;
-
// Where "thousands" markers used? Is it a european number?
if (char * p = std::strrchr(buf, ',')) {
if (std::strchr(p, '.'))
@@ -548,6 +540,14 @@ static commodity * parse_amount(mpz_t out, const char * num,
european = true;
}
+ // Determine the precision used
+ if (char * p = std::strchr(buf, european ? ',' : '.'))
+ precision = std::strlen(++p);
+ else if (char * p = std::strchr(buf, '/'))
+ precision = std::strlen(++p) - 1;
+ else
+ precision = 0;
+
// Parse the actual quantity
std::string value_str = buf;