Resolves: tdf#160985 Max integer representation for rtl_math_StringFormat_G

Same as for rtl_math_StringFormat_Automatic we want to preserve
the highest accuracy of integer values also with
rtl_math_StringFormat_G if nDecPlaces is large enough, instead of
possibly rounding into 15 digits. This occurred with
FastSaxSerializer::write(double) but rtl::OString::number(double)
and rtl::OUString::number(double) and rtl_math_doubleToString()
and rtl::str::valueOfFP() and rtl_str_valueOfDouble() and all
places calling with rtl_math_StringFormat_G are similar affected.

Question might remain why those places use
rtl_math_StringFormat_G with fixed nDecimalPlaces calculated from
RTL_STR_MAX_VALUEOFDOUBLE - SAL_N_ELEMENTS("-x.E-xxx") + 1
instead of rtl_math_StringFormat_Automatic with
rtl_math_DecimalPlaces_Max.

Change-Id: Ib388b119faed441c9020dca803649a4089da5b07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167647
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
diff --git a/sal/rtl/strtmpl.hxx b/sal/rtl/strtmpl.hxx
index 6414115..8c63f10 100644
--- a/sal/rtl/strtmpl.hxx
+++ b/sal/rtl/strtmpl.hxx
@@ -1527,6 +1527,11 @@ void doubleToString(rtl_tString** pResult, sal_Int32* pResultCapacity, sal_Int32
            }
            else
            {
                if (nOrigDigits <= nDecPlaces && aParts.exponent >= 0 && fValue < 0x1p53)
                {
                    // Use integer representation with highest accuracy.
                    nRoundDigits = nOrigDigits; // no rounding
                }
                nDecPlaces = std::max<sal_Int32>(0, nDecPlaces - nExp - 1);
                eFormat = rtl_math_StringFormat_F;
            }