summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorBaiXiaochun <bai.xiaochun.mofan@protonmail.com>2021-06-30 19:01:16 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-07-02 08:41:25 +0200
commite5c80bb69a30dfb0a3daf6061ab127d92f8142d6 (patch)
tree7d8d91219858fb4d1473191ac4f354aa864b2370 /sal
parent4d9bff6e3c7bd9361bd1516c4ff266bab07c069f (diff)
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@collabora.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/math.cxx23
1 files changed, 4 insertions, 19 deletions
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;