diff options
author | Yukio Siraichi <yukio.siraichi@gmail.com> | 2020-03-14 02:33:55 +0900 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-03-14 09:10:34 +0100 |
commit | 8f8b64cad377c6d767cdf291fd00225658bd02c5 (patch) | |
tree | de5f87582bf88b030f57742109aaa289f18e428c | |
parent | 2eb0e7594cc875dd0960822d9403b573ac00f739 (diff) |
tdf#130974 replace `rtl::math::isSignBitSet` with `std::signbit`.
Change-Id: I91235eee8c6a9d4a59c1933527b49141f64cd91b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90478
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | basegfx/source/polygon/b2dpolygontools.cxx | 2 | ||||
-rw-r--r-- | forms/source/component/scrollbar.cxx | 2 | ||||
-rw-r--r-- | sal/qa/rtl/math/test-rtl-math.cxx | 22 | ||||
-rw-r--r-- | sal/rtl/math.cxx | 6 | ||||
-rw-r--r-- | sc/inc/math.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dpgroup.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/dataprovider/datatransformation.cxx | 4 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 8 |
8 files changed, 24 insertions, 24 deletions
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 1cb61585e2b4..1a5297e967b1 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -2202,7 +2202,7 @@ namespace basegfx::utils /// return 0 for input of 0, -1 for negative and 1 for positive input int lcl_sgn( const double n ) { - return n == 0.0 ? 0 : 1 - 2*int(rtl::math::isSignBitSet(n)); + return n == 0.0 ? 0 : 1 - 2*int(std::signbit(n)); } } diff --git a/forms/source/component/scrollbar.cxx b/forms/source/component/scrollbar.cxx index 364d1823f918..4e18dd69ec56 100644 --- a/forms/source/component/scrollbar.cxx +++ b/forms/source/component/scrollbar.cxx @@ -54,7 +54,7 @@ namespace frm if ( std::isinf( nExternalValue ) ) { // set the minimum or maximum of the scroll values - OUString sLimitPropertyName = ::rtl::math::isSignBitSet( nExternalValue ) + OUString sLimitPropertyName = std::signbit( nExternalValue ) ? _rMinValueName : _rMaxValueName; if ( _rxProperties.is() ) _rxProperties->getPropertyValue( sLimitPropertyName ) >>= nControlValue; diff --git a/sal/qa/rtl/math/test-rtl-math.cxx b/sal/qa/rtl/math/test-rtl-math.cxx index 43d8e90afffc..df899634892e 100644 --- a/sal/qa/rtl/math/test-rtl-math.cxx +++ b/sal/qa/rtl/math/test-rtl-math.cxx @@ -173,7 +173,7 @@ public: CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), end); CPPUNIT_ASSERT_EQUAL(0.0, res); - CPPUNIT_ASSERT(rtl::math::isSignBitSet(res)); + CPPUNIT_ASSERT(std::signbit(res)); // Compensating: "0.001E311" is 1E308, not overflow/inf res = rtl::math::stringToDouble(OUString("0.001E311"), '.', ',', &status, &end); @@ -399,10 +399,10 @@ public: x = -0.0; res = rtl::math::expm1(x); CPPUNIT_ASSERT_EQUAL(-0.0,res); - CPPUNIT_ASSERT_EQUAL(true, rtl::math::isSignBitSet(res)); + CPPUNIT_ASSERT(std::signbit(res)); rtl::math::setInf( &x, false); res = rtl::math::expm1(x); - CPPUNIT_ASSERT_EQUAL(true, std::isinf(res) && !rtl::math::isSignBitSet(res)); + CPPUNIT_ASSERT_EQUAL(true, std::isinf(res) && !std::signbit(res)); rtl::math::setInf( &x, true); res = rtl::math::expm1(x); CPPUNIT_ASSERT_EQUAL(-1.0,res); @@ -419,13 +419,13 @@ public: x = -0.0; res = rtl::math::log1p(x); CPPUNIT_ASSERT_EQUAL(-0.0,res); - CPPUNIT_ASSERT_EQUAL(true, rtl::math::isSignBitSet(res)); + CPPUNIT_ASSERT(std::signbit(res)); rtl::math::setInf( &x, false); res = rtl::math::log1p(x); - CPPUNIT_ASSERT_EQUAL(true, std::isinf(res) && !rtl::math::isSignBitSet(res)); + CPPUNIT_ASSERT_EQUAL(true, std::isinf(res) && !std::signbit(res)); x = -1.0; res = rtl::math::log1p(x); - CPPUNIT_ASSERT_EQUAL(true, std::isinf(res) && rtl::math::isSignBitSet(res)); + CPPUNIT_ASSERT_EQUAL(true, std::isinf(res) && std::signbit(res)); x = -1.1; res = rtl::math::log1p(x); CPPUNIT_ASSERT_EQUAL(true, rtl::math::isNan(res)); @@ -452,7 +452,7 @@ public: CPPUNIT_ASSERT_EQUAL(0.0, rtl::math::acosh(1.0)); res = rtl::math::acosh(std::numeric_limits<double>::infinity()); // +Inf - CPPUNIT_ASSERT(!rtl::math::isSignBitSet(res)); + CPPUNIT_ASSERT(!std::signbit(res)); CPPUNIT_ASSERT(std::isinf(res)); // #i97605 @@ -464,13 +464,13 @@ public: double res; res = rtl::math::asinh(-std::numeric_limits<double>::infinity()); // -Inf - CPPUNIT_ASSERT(rtl::math::isSignBitSet(res)); + CPPUNIT_ASSERT(std::signbit(res)); CPPUNIT_ASSERT(std::isinf(res)); CPPUNIT_ASSERT_EQUAL(0.0, rtl::math::asinh(0.0)); res = rtl::math::asinh(std::numeric_limits<double>::infinity()); // +Inf - CPPUNIT_ASSERT(!rtl::math::isSignBitSet(res)); + CPPUNIT_ASSERT(!std::signbit(res)); CPPUNIT_ASSERT(std::isinf(res)); // #i97605 @@ -491,13 +491,13 @@ public: CPPUNIT_ASSERT(rtl::math::isNan(res)); res = rtl::math::atanh(-1.0); // -Inf - CPPUNIT_ASSERT(rtl::math::isSignBitSet(res)); + CPPUNIT_ASSERT(std::signbit(res)); CPPUNIT_ASSERT(std::isinf(res)); CPPUNIT_ASSERT_EQUAL(0.0, rtl::math::atanh(0.0)); res = rtl::math::atanh(1.0); // +Inf - CPPUNIT_ASSERT(!rtl::math::isSignBitSet(res)); + CPPUNIT_ASSERT(!std::signbit(res)); CPPUNIT_ASSERT(std::isinf(res)); res = rtl::math::atanh(2.0); // NaN diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx index 31de7f718b09..d35156aa79e6 100644 --- a/sal/rtl/math.cxx +++ b/sal/rtl/math.cxx @@ -236,7 +236,7 @@ void doubleToString(typename T::String ** pResult, // sign adjustment, instead of testing for fValue<0.0 this will also fetch // -0.0 - bool bSign = rtl::math::isSignBitSet(fValue); + bool bSign = std::signbit(fValue); if (bSign) fValue = -fValue; @@ -1042,7 +1042,7 @@ double SAL_CALL rtl_math_round(double fValue, int nDecPlaces, return std::round( fValue ); // sign adjustment - bool bSign = rtl::math::isSignBitSet( fValue ); + bool bSign = std::signbit( fValue ); if (bSign) fValue = -fValue; @@ -1168,7 +1168,7 @@ double SAL_CALL rtl_math_approxValue( double fValue ) SAL_THROW_EXTERN_C() double fOrigValue = fValue; - bool bSign = ::rtl::math::isSignBitSet(fValue); + bool bSign = std::signbit(fValue); if (bSign) fValue = -fValue; diff --git a/sc/inc/math.hxx b/sc/inc/math.hxx index 5c76a657b381..4d59d9a17a9a 100644 --- a/sc/inc/math.hxx +++ b/sc/inc/math.hxx @@ -55,7 +55,7 @@ inline double divide( const double& fNumerator, const double& fDenominator ) double fVal; if (std::isfinite( fNumerator) && fNumerator != 0.0) { - rtl::math::setInf( &fVal, rtl::math::isSignBitSet( fNumerator)); + rtl::math::setInf( &fVal, std::signbit( fNumerator)); } else { diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx index 061ad64aa5e0..fe3f58ddd524 100644 --- a/sc/source/core/data/dpgroup.cxx +++ b/sc/source/core/data/dpgroup.cxx @@ -72,7 +72,7 @@ bool ScDPGroupNumFilter::match(const ScDPItemData& rCellData) const double fVal = rValue.GetValue(); if (std::isinf(fVal)) { - if (rtl::math::isSignBitSet(fVal)) + if (std::signbit(fVal)) { // Less than the min value. if (rCellData.GetValue() < maNumInfo.mfStart) diff --git a/sc/source/ui/dataprovider/datatransformation.cxx b/sc/source/ui/dataprovider/datatransformation.cxx index cce23e1c1505..93b84cf0869a 100644 --- a/sc/source/ui/dataprovider/datatransformation.cxx +++ b/sc/source/ui/dataprovider/datatransformation.cxx @@ -483,7 +483,7 @@ void NumberTransformation::Transform(ScDocument& rDoc) const if (eType == CELLTYPE_VALUE) { double nVal = rDoc.GetValue(rCol, nRow, 0); - if(rtl::math::isSignBitSet(nVal)) + if(std::signbit(nVal)) rDoc.SetValue(rCol, nRow, 0, -1 * nVal); } } @@ -568,7 +568,7 @@ void NumberTransformation::Transform(ScDocument& rDoc) const if (eType == CELLTYPE_VALUE) { double nVal = rDoc.GetValue(rCol, nRow, 0); - if (!rtl::math::isSignBitSet(nVal)) + if (!std::signbit(nVal)) { rDoc.SetValue(rCol, nRow, 0, sqrt(nVal)); } diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 81b20c92bfbb..e522977afdff 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -2245,7 +2245,7 @@ namespace { void lcl_GetOutputStringScientific(double fNumber, sal_uInt16 nCharCount, const SvNumberFormatter& rFormatter, OUString& rOutString) { - bool bSign = ::rtl::math::isSignBitSet(fNumber); + bool bSign = std::signbit(fNumber); // 1.000E+015 (one digit and the decimal point, and the two chars + // nExpDigit for the exponential part, totalling 6 or 7). @@ -2369,7 +2369,7 @@ bool SvNumberformat::GetOutputString(double fNumber, sal_uInt16 nCharCount, OUSt return false; } double fTestNum = fNumber; - bool bSign = ::rtl::math::isSignBitSet(fTestNum); + bool bSign = std::signbit(fTestNum); if (bSign) { fTestNum = -fTestNum; @@ -2474,7 +2474,7 @@ bool SvNumberformat::GetOutputString(double fNumber, case SvNumFormatType::NUMBER: // Standard number format if (rScan.GetStandardPrec() == SvNumberFormatter::UNLIMITED_PRECISION) { - if (::rtl::math::isSignBitSet(fNumber)) + if (std::signbit(fNumber)) { if (!(fNumber < 0.0)) fNumber = -fNumber; // do not display -0.0 @@ -4245,7 +4245,7 @@ bool SvNumberformat::ImpGetNumberOutput(double fNumber, else { bSign = false; - if ( ::rtl::math::isSignBitSet( fNumber ) ) + if ( std::signbit( fNumber ) ) { fNumber = -fNumber; // yes, -0.0 is possible, eliminate '-' } |