[Libreoffice-commits] core.git: sal/rtl
BaiXiaochun (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 2 06:41:59 UTC 2021
sal/rtl/math.cxx | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)
New commits:
commit e5c80bb69a30dfb0a3daf6061ab127d92f8142d6
Author: BaiXiaochun <bai.xiaochun.mofan at protonmail.com>
AuthorDate: Wed Jun 30 19:01:16 2021 +0200
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Jul 2 08:41:25 2021 +0200
Purge out setNan from math.cxx
Change-Id: I95f9b37b564bb733f44899a8c6c1ea3c36e35694
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118196
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 88354763b2b4..75981d970d74 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -865,7 +865,7 @@ double stringToDouble(CharT const * pBegin, CharT const * pEnd,
&& (CharT('N') == p[2]))
{
p += 3;
- rtl::math::setNan( &fVal );
+ fVal = std::numeric_limits<double>::quiet_NaN();
bDone = true;
}
else if ((CharT('I') == p[0]) && (CharT('N') == p[1])
@@ -1012,19 +1012,8 @@ double stringToDouble(CharT const * pBegin, CharT const * pEnd,
{
// "1.#NAN", "+1.#NAN", "-1.#NAN"
p += 4;
- rtl::math::setNan( &fVal );
- if (bSign)
- {
- union {
- double sd;
- sal_math_Double md;
- } m;
-
- m.sd = fVal;
- m.md.w32_parts.msw |= 0x80000000; // create negative NaN
- fVal = m.sd;
- bSign = false; // don't negate again
- }
+ fVal = std::numeric_limits<double>::quiet_NaN();
+ // bSign will cause negation of fVal in the end, producing a negative NAN.
// Eat any further digits:
while (p != pEnd && rtl::isAsciiDigit(*p))
@@ -1443,11 +1432,7 @@ double SAL_CALL rtl_math_acosh(double fX) SAL_THROW_EXTERN_C()
{
volatile double fZ = fX - 1.0;
if (fX < 1.0)
- {
- double fResult;
- ::rtl::math::setNan( &fResult );
- return fResult;
- }
+ return std::numeric_limits<double>::quiet_NaN();
if ( fX == 1.0 )
return 0.0;
More information about the Libreoffice-commits
mailing list