about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorlogin <login@tilde.team>2023-11-22 09:54:04 +0000
committerlogin <login@tilde.team>2023-11-22 09:54:04 +0000
commit5128e4408d51d5d35af008fe8212a2ddde3bd798 (patch)
tree68a51350527d108781bc07dac27e6d4b9bd9289f
parentec88d6193483984a3a2f8351e40ff0994e7c0946 (diff)
downloadtcoin-5128e4408d51d5d35af008fe8212a2ddde3bd798.tar.gz
Fix to thousands separator function
The thousands separator function used to add leading zeros to numbers less than three digits. That has been fixed now.
-rw-r--r--tcoin.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/tcoin.cpp b/tcoin.cpp
index 2c728a2..e3bde74 100644
--- a/tcoin.cpp
+++ b/tcoin.cpp
@@ -399,13 +399,15 @@ void num_stream_thousands_sep(std::ostringstream& ss, long long int const& amoun
       mini_residue = mini_reduced_amount % 10;
       mini_reduced_amount /= 10;
     }
-    for(int i=num_residue_digits; i<3; ++i)
-    {
-      rev << 0;
-    }
 
     if(reduced_amount > 0)
+    {
+      for(int i=num_residue_digits; i<3; ++i)
+      {
+        rev << 0;
+      }
       rev << sep;
+    }
 
     residue = reduced_amount % 1000;
     residue_gte_100 = residue >= 100;