sal/rtl/math.cxx |   14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

New commits:
commit 0cea377f8ca91b5374a59bfba61ac1290dad00c0
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Sep 18 13:19:30 2025 +0500
Commit:     Miklos Vajna <[email protected]>
CommitDate: Tue Sep 30 08:50:30 2025 +0200

    Small normalization/cleanup
    
    Change-Id: Ia1d3f6ae8f61ff2c3c380e191d16cdb9e23e6083
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191146
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit 4f98b46d391719306c08e01a2c6b327647d738bd)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191300
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 0a2993023aa2..8106c28e7c44 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -212,7 +212,7 @@ double stringToDouble(CharT const* pBegin, CharT const* 
pEnd, CharT cDecSeparato
         else if (('I' == p[0]) && ('N' == p[1]) && ('F' == p[2]))
         {
             p += 3;
-            fVal = HUGE_VAL;
+            fVal = std::numeric_limits<double>::infinity();
             eStatus = rtl_math_ConversionStatus_OutOfRange;
             bDone = true;
         }
@@ -300,9 +300,8 @@ double stringToDouble(CharT const* pBegin, CharT const* 
pEnd, CharT cDecSeparato
             {
                 CharT c = *p;
                 if (!rtl::isAsciiDigit(c))
-                {
                     break;
-                }
+
                 buf.insert(c, p);
             }
         }
@@ -335,7 +334,7 @@ double stringToDouble(CharT const* pBegin, CharT const* 
pEnd, CharT cDecSeparato
             {
                 // "1.#INF", "+1.#INF", "-1.#INF"
                 p += 4;
-                fVal = HUGE_VAL;
+                fVal = std::numeric_limits<double>::infinity();
                 eStatus = rtl_math_ConversionStatus_OutOfRange;
                 // Eat any further digits:
                 while (p != pEnd && rtl::isAsciiDigit(*p))
@@ -351,9 +350,7 @@ double stringToDouble(CharT const* pBegin, CharT const* 
pEnd, CharT cDecSeparato
 
                 // Eat any further digits:
                 while (p != pEnd && rtl::isAsciiDigit(*p))
-                {
                     ++p;
-                }
                 bDone = true;
             }
         }
@@ -392,16 +389,13 @@ double stringToDouble(CharT const* pBegin, CharT const* 
pEnd, CharT cDecSeparato
         }
     }
 
-    if (bSign)
-        fVal = -fVal;
-
     if (pStatus)
         *pStatus = eStatus;
 
     if (pParsedEnd)
         *pParsedEnd = p == p0 ? pBegin : p;
 
-    return fVal;
+    return bSign ? -fVal : fVal;
 }
 }
 

Reply via email to