@@ -1687,7 +1687,7 @@ decimal<Prec, RoundPolicy> decimal_cast(const char (&arg)[N]) {
16871687 // / bbbb is stream of digits before decimal point
16881688 // / aaaa is stream of digits after decimal point
16891689 template <class decimal_type , typename StreamType>
1690- void toStream (const decimal_type &arg, const basic_decimal_format &format, StreamType &output) {
1690+ void toStream (const decimal_type &arg, const basic_decimal_format &format, StreamType &output, bool formatFromStream = false ) {
16911691 using namespace std ;
16921692
16931693 int64 before, after;
@@ -1711,7 +1711,7 @@ decimal<Prec, RoundPolicy> decimal_cast(const char (&arg)[N]) {
17111711 }
17121712
17131713 std::locale oldloc = output.getloc ();
1714- if (format.thousands_grouping () && format.change_thousands_if_needed ()) {
1714+ if (!formatFromStream || ( format.thousands_grouping () && format.change_thousands_if_needed () )) {
17151715 output.imbue ( std::locale ( std::locale::classic (), new decimal_format_punct (format) ) );
17161716 output << before;
17171717 output.imbue (oldloc);
@@ -1730,7 +1730,7 @@ decimal<Prec, RoundPolicy> decimal_cast(const char (&arg)[N]) {
17301730
17311731 template <class decimal_type , typename StreamType>
17321732 void toStream (const decimal_type &arg, StreamType &output) {
1733- toStream (arg, format_from_stream (output), output);
1733+ toStream (arg, format_from_stream (output), output, true );
17341734 }
17351735
17361736namespace details {
0 commit comments