[Libreoffice-commits] core.git: chart2/qa chart2/source dbaccess/source include/formula oox/source sc/inc sc/qa sc/source svtools/source sw/source vcl/source xmloff/source
BaiXiaochun (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 30 07:53:24 UTC 2021
chart2/qa/extras/charttest.hxx | 5 -
chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx | 5 -
chart2/source/controller/dialogs/DataBrowser.cxx | 13 --
chart2/source/controller/dialogs/DataBrowserModel.cxx | 10 --
chart2/source/inc/CommonFunctors.hxx | 10 +-
chart2/source/tools/CommonConverters.cxx | 5 -
chart2/source/tools/DiagramHelper.cxx | 6 -
chart2/source/tools/ExplicitCategoriesProvider.cxx | 7 -
chart2/source/tools/ExponentialRegressionCurveCalculator.cxx | 20 +---
chart2/source/tools/InternalData.cxx | 26 +----
chart2/source/tools/InternalDataProvider.cxx | 12 --
chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx | 19 +--
chart2/source/tools/MeanValueRegressionCurveCalculator.cxx | 9 +
chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx | 8 -
chart2/source/tools/PolynomialRegressionCurveCalculator.cxx | 12 --
chart2/source/tools/PotentialRegressionCurveCalculator.cxx | 20 +---
chart2/source/tools/RegressionCurveCalculator.cxx | 6 -
chart2/source/tools/Scaling.cxx | 32 ++----
chart2/source/tools/StatisticsHelper.cxx | 35 ++-----
chart2/source/view/axes/DateScaling.cxx | 6 -
chart2/source/view/axes/MinimumAndMaximumSupplier.cxx | 14 +-
chart2/source/view/axes/ScaleAutomatism.cxx | 4
chart2/source/view/axes/VCartesianAxis.cxx | 8 -
chart2/source/view/charttypes/AreaChart.cxx | 10 +-
chart2/source/view/charttypes/BarChart.cxx | 8 -
chart2/source/view/charttypes/BubbleChart.cxx | 10 +-
chart2/source/view/charttypes/NetChart.cxx | 11 +-
chart2/source/view/charttypes/PieChart.cxx | 7 -
chart2/source/view/charttypes/VSeriesPlotter.cxx | 46 ++++-----
chart2/source/view/main/VDataSeries.cxx | 49 +++-------
dbaccess/source/core/misc/DatabaseDataProvider.cxx | 6 -
include/formula/errorcodes.hxx | 4
oox/source/export/chartexport.cxx | 6 -
sc/inc/PivotTableDataSequence.hxx | 9 -
sc/qa/unit/ucalc.cxx | 4
sc/source/core/data/column2.cxx | 19 +--
sc/source/core/data/dociter.cxx | 7 -
sc/source/core/data/dpobject.cxx | 12 +-
sc/source/core/data/dpoutput.cxx | 5 -
sc/source/core/data/dpresfilter.cxx | 9 -
sc/source/core/data/dptabres.cxx | 6 -
sc/source/core/opencl/formulagroupcl.cxx | 5 -
sc/source/core/tool/formulagroup.cxx | 7 -
sc/source/core/tool/interpr4.cxx | 4
sc/source/filter/oox/biffhelper.cxx | 4
sc/source/filter/orcus/interface.cxx | 7 -
sc/source/filter/xml/xmlcelli.cxx | 5 -
sc/source/ui/miscdlgs/solveroptions.cxx | 2
sc/source/ui/unoobj/PivotTableDataProvider.cxx | 7 -
sc/source/ui/unoobj/chart2uno.cxx | 13 +-
svtools/source/table/cellvalueconversion.cxx | 14 +-
sw/source/core/unocore/unotbl.cxx | 11 --
vcl/source/control/fmtfield.cxx | 10 --
xmloff/source/chart/SchXMLExport.cxx | 7 -
xmloff/source/chart/SchXMLTableContext.cxx | 13 --
55 files changed, 252 insertions(+), 377 deletions(-)
New commits:
commit 7838efe4b703945ccde963f8506c8c7744e04e6e
Author: BaiXiaochun <bai.xiaochun.mofan at protonmail.com>
AuthorDate: Tue Jun 29 17:38:29 2021 +0200
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Jun 30 09:52:45 2021 +0200
Purge out rtl::math::setNan
Change-Id: If8794c105e279afd4437517d3e61f2f900eb6490
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118123
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx
index 0a7b00cc884e..9b162acc06e8 100644
--- a/chart2/qa/extras/charttest.hxx
+++ b/chart2/qa/extras/charttest.hxx
@@ -442,9 +442,6 @@ std::vector<std::vector<double> > getDataSeriesYValuesFromChartType( const Refer
CPPUNIT_ASSERT(xDSCont.is());
const Sequence<uno::Reference<chart2::XDataSeries> > aDataSeriesSeq = xDSCont->getDataSeries();
- double fNan;
- rtl::math::setNan(&fNan);
-
std::vector<std::vector<double> > aRet;
for (uno::Reference<chart2::XDataSeries> const & ds : aDataSeriesSeq)
{
@@ -472,7 +469,7 @@ std::vector<std::vector<double> > getDataSeriesYValuesFromChartType( const Refer
if (any >>= fVal)
aValues.push_back(fVal);
else
- aValues.push_back(fNan);
+ aValues.push_back(std::numeric_limits<double>::quiet_NaN());
}
aRet.push_back(aValues);
}
diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
index 9fc30c823a79..aabdce1c8f65 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
@@ -28,7 +28,8 @@
#include <com/sun/star/chart/XChartDocument.hpp>
#include <float.h>
-#include <rtl/math.hxx>
+#include <cmath>
+#include <limits>
#include <osl/diagnose.h>
using namespace ::com::sun::star;
@@ -57,7 +58,7 @@ uno::Sequence< uno::Sequence< double > > lcl_getNANInsteadDBL_MIN( const uno::Se
aRet[nOuter][nInner] = rData[nOuter][nInner];
double& rValue = aRet[nOuter][nInner];
if( rValue == DBL_MIN )
- ::rtl::math::setNan( &rValue );
+ rValue = std::numeric_limits<double>::quiet_NaN();
}
}
return aRet;
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index 37e820eb5d94..e5e9be3b99a5 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -35,7 +35,6 @@
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/virdev.hxx>
-#include <rtl/math.hxx>
#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <toolkit/helper/vclunohelper.hxx>
@@ -45,6 +44,7 @@
#include <com/sun/star/container/XIndexReplace.hpp>
#include <algorithm>
+#include <limits>
using namespace ::com::sun::star;
@@ -489,10 +489,8 @@ DataBrowser::DataBrowser(const css::uno::Reference<css::awt::XWindow> &rParent,
m_rNumberEditController( new ::svt::FormattedFieldCellController( m_aNumberEditField.get() )),
m_rTextEditController( new ::svt::EditCellController( m_aTextEditField.get() ))
{
- double fNan;
- ::rtl::math::setNan( & fNan );
Formatter& rFormatter = m_aNumberEditField->get_formatter();
- rFormatter.SetDefaultValue( fNan );
+ rFormatter.SetDefaultValue( std::numeric_limits<double>::quiet_NaN() );
rFormatter.TreatAsNumber( true );
RenewTable();
}
@@ -741,16 +739,13 @@ OUString DataBrowser::GetCellText( sal_Int32 nRow, sal_uInt16 nColumnId ) const
double DataBrowser::GetCellNumber( sal_Int32 nRow, sal_uInt16 nColumnId ) const
{
- double fResult;
- ::rtl::math::setNan( & fResult );
-
if(( nColumnId >= 1 ) && ( nRow >= 0 ) && m_apDataBrowserModel)
{
- fResult = m_apDataBrowserModel->getCellNumber(
+ return m_apDataBrowserModel->getCellNumber(
static_cast< sal_Int32 >( nColumnId ) - 1, nRow );
}
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
}
void DataBrowser::Resize()
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index c8359f74ab23..8de5c31e32dc 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -45,9 +45,8 @@
#include <tools/diagnose_ex.h>
#include <comphelper/property.hxx>
-#include <rtl/math.hxx>
-
#include <algorithm>
+#include <limits>
using namespace ::com::sun::star;
@@ -582,9 +581,6 @@ DataBrowserModel::eCellType DataBrowserModel::getCellType( sal_Int32 nAtColumn )
double DataBrowserModel::getCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow )
{
- double fResult;
- ::rtl::math::setNan( & fResult );
-
tDataColumnVector::size_type nIndex( nAtColumn );
if( nIndex < m_aColumns.size() &&
m_aColumns[ nIndex ].m_xLabeledDataSequence.is())
@@ -595,10 +591,10 @@ double DataBrowserModel::getCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow )
{
Sequence< double > aValues( xData->getNumericalData());
if( nAtRow < aValues.getLength())
- fResult = aValues[nAtRow];
+ return aValues[nAtRow];
}
}
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
}
uno::Any DataBrowserModel::getCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow )
diff --git a/chart2/source/inc/CommonFunctors.hxx b/chart2/source/inc/CommonFunctors.hxx
index 9bdbce5af535..0340c82b692e 100644
--- a/chart2/source/inc/CommonFunctors.hxx
+++ b/chart2/source/inc/CommonFunctors.hxx
@@ -24,6 +24,8 @@
#include <rtl/ustring.hxx>
#include "charttoolsdllapi.hxx"
+#include <limits>
+
namespace chart::CommonFunctors
{
@@ -43,15 +45,13 @@ template< typename T >
/** unary function to convert css::uno::Any into a double number.
- <p>In case no number can be generated from the Any, NaN (see
- rtl::math::SetNAN()) is returned.</p>
+ <p>In case no number can be generated from the Any, NaN is returned.</p>
*/
struct OOO_DLLPUBLIC_CHARTTOOLS AnyToDouble
{
double operator() ( const css::uno::Any & rAny )
{
- double fResult;
- ::rtl::math::setNan( & fResult );
+ double fResult = std::numeric_limits<double>::quiet_NaN();
rAny >>= fResult;
return fResult;
}
@@ -97,7 +97,7 @@ struct OOO_DLLPUBLIC_CHARTTOOLS OUStringToDouble
double fResult = ::rtl::math::stringToDouble( rStr, '.', ',', & eConversionStatus );
if( eConversionStatus != rtl_math_ConversionStatus_Ok )
- ::rtl::math::setNan( & fResult );
+ return std::numeric_limits<double>::quiet_NaN();
return fResult;
}
diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx
index 76bb4a071b7c..4993c749f2ca 100644
--- a/chart2/source/tools/CommonConverters.cxx
+++ b/chart2/source/tools/CommonConverters.cxx
@@ -24,10 +24,11 @@
#include <com/sun/star/chart2/data/XDataSequence.hpp>
#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
-#include <rtl/math.hxx>
#include <osl/diagnose.h>
#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <limits>
+
namespace chart
{
@@ -429,7 +430,7 @@ uno::Sequence< double > DataSequenceToDoubleSequence(
for(sal_Int32 nN=aValues.getLength();nN--;)
{
if( !(aValues[nN] >>= aResult[nN]) )
- ::rtl::math::setNan( &aResult[nN] );
+ aResult[nN] = std::numeric_limits<double>::quiet_NaN();
}
}
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index 80a75f333d28..3fbb442cccd8 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -57,6 +57,8 @@
#include <tools/diagnose_ex.h>
#include <sal/log.hxx>
+#include <limits>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
using namespace ::std;
@@ -975,8 +977,6 @@ void lcl_switchToDateCategories( const Reference< XChartDocument >& xChartDoc, c
{
Sequence< Sequence< Any > > aAnyCategories( xDataAccess->getAnyRowDescriptions() );
double fTest = 0.0;
- double fNan = 0.0;
- ::rtl::math::setNan( & fNan );
sal_Int32 nN = aAnyCategories.getLength();
for( ; nN--; )
{
@@ -988,7 +988,7 @@ void lcl_switchToDateCategories( const Reference< XChartDocument >& xChartDoc, c
Any& rAny = rCat[0];
if( !(rAny>>=fTest) )
{
- rAny <<= fNan;
+ rAny <<= std::numeric_limits<double>::quiet_NaN();
}
}
}
diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx
index bf65f58ec850..57919f3cbada 100644
--- a/chart2/source/tools/ExplicitCategoriesProvider.cxx
+++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx
@@ -29,9 +29,11 @@
#include <com/sun/star/chart2/AxisType.hpp>
#include <o3tl/safeint.hxx>
-#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
#include <tools/diagnose_ex.h>
+#include <limits>
+
namespace chart
{
@@ -453,8 +455,7 @@ static bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >&
{
if( aAny.hasValue() && !bContainsEmptyString )//empty string does not count as non date value!
bOnlyDatesFound=false;
- ::rtl::math::setNan( &aDate );
- rDateCategories.push_back( aDate );
+ rDateCategories.push_back( std::numeric_limits<double>::quiet_NaN() );
}
}
std::sort( rDateCategories.begin(), rDateCategories.end() );
diff --git a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
index 1d389d6f99bf..a5063ee1039b 100644
--- a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
@@ -19,6 +19,7 @@
#include <sal/config.h>
+#include <limits>
#include <string_view>
#include <ExponentialRegressionCurveCalculator.hxx>
@@ -34,12 +35,10 @@ namespace chart
{
ExponentialRegressionCurveCalculator::ExponentialRegressionCurveCalculator()
- : m_fLogSlope(0.0)
- , m_fLogIntercept(0.0)
+ : m_fLogSlope(std::numeric_limits<double>::quiet_NaN())
+ , m_fLogIntercept(std::numeric_limits<double>::quiet_NaN())
, m_fSign(1.0)
{
- ::rtl::math::setNan( & m_fLogSlope );
- ::rtl::math::setNan( & m_fLogIntercept );
}
ExponentialRegressionCurveCalculator::~ExponentialRegressionCurveCalculator()
@@ -65,9 +64,9 @@ void SAL_CALL ExponentialRegressionCurveCalculator::recalculateRegression(
nMax = aValues.first.size();
if( nMax <= 1 )
{
- ::rtl::math::setNan( & m_fLogSlope );
- ::rtl::math::setNan( & m_fLogIntercept );
- ::rtl::math::setNan( & m_fCorrelationCoefficient );// actual it is coefficient of determination
+ m_fLogSlope = std::numeric_limits<double>::quiet_NaN();
+ m_fLogIntercept = std::numeric_limits<double>::quiet_NaN();
+ m_fCorrelationCoefficient = std::numeric_limits<double>::quiet_NaN();// actual it is coefficient of determination
return;
}
m_fSign = -1.0;
@@ -116,16 +115,13 @@ void SAL_CALL ExponentialRegressionCurveCalculator::recalculateRegression(
double SAL_CALL ExponentialRegressionCurveCalculator::getCurveValue( double x )
{
- double fResult;
- ::rtl::math::setNan( & fResult );
-
if( ! ( std::isnan( m_fLogSlope ) ||
std::isnan( m_fLogIntercept )))
{
- fResult = m_fSign * exp(m_fLogIntercept + x * m_fLogSlope);
+ return m_fSign * exp(m_fLogIntercept + x * m_fLogSlope);
}
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
}
uno::Sequence< geometry::RealPoint2D > SAL_CALL ExponentialRegressionCurveCalculator::getCurveValues(
diff --git a/chart2/source/tools/InternalData.cxx b/chart2/source/tools/InternalData.cxx
index 35c615fe2873..1f5bcddc6c82 100644
--- a/chart2/source/tools/InternalData.cxx
+++ b/chart2/source/tools/InternalData.cxx
@@ -22,7 +22,6 @@
#include <strings.hrc>
#include <osl/diagnose.h>
-#include <rtl/math.hxx>
#ifdef DEBUG_CHART2_TOOLS
#define DEBUG_INTERNAL_DATA 1
@@ -34,6 +33,7 @@
#include <algorithm>
#include <iterator>
+#include <limits>
using ::com::sun::star::uno::Sequence;
@@ -129,10 +129,8 @@ void InternalData::setData( const Sequence< Sequence< double > >& rDataInRows )
m_aColumnLabels.resize( m_nColumnCount );
m_aData.resize( m_nRowCount * m_nColumnCount );
- double fNan;
- ::rtl::math::setNan( & fNan );
// set all values to Nan
- m_aData = fNan;
+ m_aData = std::numeric_limits<double>::quiet_NaN();
for( sal_Int32 nRow=0; nRow<m_nRowCount; ++nRow )
{
@@ -296,9 +294,7 @@ bool InternalData::enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount )
if( bGrow )
{
- double fNan;
- ::rtl::math::setNan( &fNan );
- tDataType aNewData( fNan, nNewSize );
+ tDataType aNewData( std::numeric_limits<double>::quiet_NaN(), nNewSize );
// copy old data
for( int nCol=0; nCol<m_nColumnCount; ++nCol )
static_cast< tDataType >(
@@ -322,9 +318,7 @@ void InternalData::insertColumn( sal_Int32 nAfterIndex )
sal_Int32 nNewColumnCount = m_nColumnCount + 1;
sal_Int32 nNewSize( nNewColumnCount * m_nRowCount );
- double fNan;
- ::rtl::math::setNan( &fNan );
- tDataType aNewData( fNan, nNewSize );
+ tDataType aNewData( std::numeric_limits<double>::quiet_NaN(), nNewSize );
// copy old data
int nCol=0;
@@ -379,9 +373,7 @@ void InternalData::insertRow( sal_Int32 nAfterIndex )
sal_Int32 nNewRowCount = m_nRowCount + 1;
sal_Int32 nNewSize( m_nColumnCount * nNewRowCount );
- double fNan;
- ::rtl::math::setNan( &fNan );
- tDataType aNewData( fNan, nNewSize );
+ tDataType aNewData( std::numeric_limits<double>::quiet_NaN(), nNewSize );
// copy old data
sal_Int32 nIndex = nAfterIndex + 1;
@@ -416,9 +408,7 @@ void InternalData::deleteColumn( sal_Int32 nAtIndex )
sal_Int32 nNewColumnCount = m_nColumnCount - 1;
sal_Int32 nNewSize( nNewColumnCount * m_nRowCount );
- double fNan;
- ::rtl::math::setNan( &fNan );
- tDataType aNewData( fNan, nNewSize );
+ tDataType aNewData( std::numeric_limits<double>::quiet_NaN(), nNewSize );
// copy old data
int nCol=0;
@@ -450,9 +440,7 @@ void InternalData::deleteRow( sal_Int32 nAtIndex )
sal_Int32 nNewRowCount = m_nRowCount - 1;
sal_Int32 nNewSize( m_nColumnCount * nNewRowCount );
- double fNan;
- ::rtl::math::setNan( &fNan );
- tDataType aNewData( fNan, nNewSize );
+ tDataType aNewData( std::numeric_limits<double>::quiet_NaN(), nNewSize );
// copy old data
sal_Int32 nIndex = nAtIndex;
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index e9beeb6d1d41..505159fa87b6 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -17,8 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <rtl/math.hxx>
-
#include <iterator>
#include <InternalDataProvider.hxx>
@@ -40,6 +38,7 @@
#include <comphelper/property.hxx>
#include <tools/diagnose_ex.h>
+#include <limits>
#include <vector>
#include <algorithm>
@@ -1365,16 +1364,15 @@ uno::Sequence< OUString > SplitCategoriesProvider_ForComplexDescriptions::getStr
// ____ XDateCategories ____
Sequence< double > SAL_CALL InternalDataProvider::getDateCategories()
{
- double fNan = InternalDataProvider::getNotANumber();
- double fValue = fNan;
vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
sal_Int32 nCount = aCategories.size();
Sequence< double > aDoubles( nCount );
sal_Int32 nN=0;
for (auto const& category : aCategories)
{
+ double fValue;
if( category.empty() || !(category[0]>>=fValue) )
- fValue = fNan;
+ fValue = std::numeric_limits<double>::quiet_NaN();
aDoubles[nN++]=fValue;
}
return aDoubles;
@@ -1489,9 +1487,7 @@ void SAL_CALL InternalDataProvider::removeChartDataChangeEventListener(
double SAL_CALL InternalDataProvider::getNotANumber()
{
- double fNan;
- ::rtl::math::setNan( & fNan );
- return fNan;
+ return std::numeric_limits<double>::quiet_NaN();
}
sal_Bool SAL_CALL InternalDataProvider::isNotANumber( double nNumber )
diff --git a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
index bfa5d9e4be5d..c9e000e0243e 100644
--- a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
@@ -30,11 +30,9 @@ namespace chart
{
LogarithmicRegressionCurveCalculator::LogarithmicRegressionCurveCalculator() :
- m_fSlope( 0.0 ),
- m_fIntercept( 0.0 )
+ m_fSlope( std::numeric_limits<double>::quiet_NaN() ),
+ m_fIntercept( std::numeric_limits<double>::quiet_NaN() )
{
- ::rtl::math::setNan( & m_fSlope );
- ::rtl::math::setNan( & m_fIntercept );
}
LogarithmicRegressionCurveCalculator::~LogarithmicRegressionCurveCalculator()
@@ -53,9 +51,9 @@ void SAL_CALL LogarithmicRegressionCurveCalculator::recalculateRegression(
const size_t nMax = aValues.first.size();
if( nMax <= 1 ) // at least 2 points
{
- ::rtl::math::setNan( & m_fSlope );
- ::rtl::math::setNan( & m_fIntercept );
- ::rtl::math::setNan( & m_fCorrelationCoefficient );
+ m_fSlope = std::numeric_limits<double>::quiet_NaN();
+ m_fIntercept = std::numeric_limits<double>::quiet_NaN();
+ m_fCorrelationCoefficient = std::numeric_limits<double>::quiet_NaN();
return;
}
@@ -89,16 +87,13 @@ void SAL_CALL LogarithmicRegressionCurveCalculator::recalculateRegression(
double SAL_CALL LogarithmicRegressionCurveCalculator::getCurveValue( double x )
{
- double fResult;
- ::rtl::math::setNan( & fResult );
-
if( ! ( std::isnan( m_fSlope ) ||
std::isnan( m_fIntercept )))
{
- fResult = m_fSlope * log( x ) + m_fIntercept;
+ return m_fSlope * log( x ) + m_fIntercept;
}
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
}
uno::Sequence< geometry::RealPoint2D > SAL_CALL LogarithmicRegressionCurveCalculator::getCurveValues(
diff --git a/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx b/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx
index c9821343b4ec..70c3f1822de4 100644
--- a/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx
@@ -20,7 +20,9 @@
#include <MeanValueRegressionCurveCalculator.hxx>
#include <osl/diagnose.h>
-#include <rtl/math.hxx>
+
+#include <cmath>
+#include <limits>
using namespace ::com::sun::star;
@@ -28,9 +30,8 @@ namespace chart
{
MeanValueRegressionCurveCalculator::MeanValueRegressionCurveCalculator() :
- m_fMeanValue( 0.0 )
+ m_fMeanValue( std::numeric_limits<double>::quiet_NaN() )
{
- ::rtl::math::setNan( & m_fMeanValue );
}
MeanValueRegressionCurveCalculator::~MeanValueRegressionCurveCalculator()
@@ -59,7 +60,7 @@ void SAL_CALL MeanValueRegressionCurveCalculator::recalculateRegression(
if( nMax == 0 )
{
- ::rtl::math::setNan( & m_fMeanValue );
+ m_fMeanValue = std::numeric_limits<double>::quiet_NaN();
}
else
{
diff --git a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
index 1c456b8835e6..d21ec8d27714 100644
--- a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
@@ -22,7 +22,7 @@
#include <ResId.hxx>
#include <strings.hrc>
-#include <rtl/math.hxx>
+#include <limits>
#include <com/sun/star/chart2/MovingAverageType.hpp>
@@ -43,7 +43,7 @@ void SAL_CALL MovingAverageRegressionCurveCalculator::recalculateRegression(
const uno::Sequence< double >& aXValues,
const uno::Sequence< double >& aYValues )
{
- ::rtl::math::setNan( & m_fCorrelationCoefficient );
+ m_fCorrelationCoefficient = std::numeric_limits<double>::quiet_NaN();
RegressionCalculationHelper::tDoubleVectorPair aValues(
RegressionCalculationHelper::cleanup(
@@ -134,9 +134,7 @@ void MovingAverageRegressionCurveCalculator::calculateValues(
double SAL_CALL MovingAverageRegressionCurveCalculator::getCurveValue( double /*x*/ )
{
- double fResult;
- rtl::math::setNan(&fResult);
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
}
uno::Sequence< geometry::RealPoint2D > SAL_CALL MovingAverageRegressionCurveCalculator::getCurveValues(
diff --git a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
index 38e326cbbbc4..d6b22c1635f5 100644
--- a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
@@ -21,6 +21,7 @@
#include <RegressionCalculationHelper.hxx>
#include <cmath>
+#include <limits>
#include <rtl/math.hxx>
#include <rtl/ustrbuf.hxx>
@@ -90,7 +91,7 @@ void SAL_CALL PolynomialRegressionCurveCalculator::recalculateRegression(
const uno::Sequence< double >& aXValues,
const uno::Sequence< double >& aYValues )
{
- rtl::math::setNan(&m_fCorrelationCoefficient);
+ m_fCorrelationCoefficient = std::numeric_limits<double>::quiet_NaN();
RegressionCalculationHelper::tDoubleVectorPair aValues(
RegressionCalculationHelper::cleanup( aXValues, aYValues, RegressionCalculationHelper::isValid()));
@@ -269,18 +270,13 @@ void SAL_CALL PolynomialRegressionCurveCalculator::recalculateRegression(
double SAL_CALL PolynomialRegressionCurveCalculator::getCurveValue( double x )
{
- double fResult;
- rtl::math::setNan(&fResult);
-
if (mCoefficients.empty())
- {
- return fResult;
- }
+ return std::numeric_limits<double>::quiet_NaN();
sal_Int32 aNoCoefficients = static_cast<sal_Int32>(mCoefficients.size());
// Horner's method
- fResult = 0.0;
+ double fResult = 0.0;
for (sal_Int32 i = aNoCoefficients - 1; i >= 0; i--)
{
fResult = mCoefficients[i] + (x * fResult);
diff --git a/chart2/source/tools/PotentialRegressionCurveCalculator.cxx b/chart2/source/tools/PotentialRegressionCurveCalculator.cxx
index 89f6dc5b9e6e..1fa82434e0b4 100644
--- a/chart2/source/tools/PotentialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/PotentialRegressionCurveCalculator.cxx
@@ -21,6 +21,7 @@
#include <RegressionCalculationHelper.hxx>
#include <SpecialCharacters.hxx>
+#include <limits>
#include <rtl/math.hxx>
#include <rtl/ustrbuf.hxx>
@@ -30,12 +31,10 @@ namespace chart
{
PotentialRegressionCurveCalculator::PotentialRegressionCurveCalculator()
- : m_fSlope(0.0)
- , m_fIntercept(0.0)
+ : m_fSlope(std::numeric_limits<double>::quiet_NaN())
+ , m_fIntercept(std::numeric_limits<double>::quiet_NaN())
, m_fSign(1.0)
{
- ::rtl::math::setNan( & m_fSlope );
- ::rtl::math::setNan( & m_fIntercept );
}
PotentialRegressionCurveCalculator::~PotentialRegressionCurveCalculator()
@@ -61,9 +60,9 @@ void SAL_CALL PotentialRegressionCurveCalculator::recalculateRegression(
nMax = aValues.first.size();
if( nMax <= 1 )
{
- ::rtl::math::setNan( & m_fSlope );
- ::rtl::math::setNan( & m_fIntercept );
- ::rtl::math::setNan( & m_fCorrelationCoefficient );
+ m_fSlope = std::numeric_limits<double>::quiet_NaN();
+ m_fIntercept = std::numeric_limits<double>::quiet_NaN();
+ m_fCorrelationCoefficient = std::numeric_limits<double>::quiet_NaN();
return;
}
m_fSign = -1.0;
@@ -101,16 +100,13 @@ void SAL_CALL PotentialRegressionCurveCalculator::recalculateRegression(
double SAL_CALL PotentialRegressionCurveCalculator::getCurveValue( double x )
{
- double fResult;
- ::rtl::math::setNan( & fResult );
-
if( ! ( std::isnan( m_fSlope ) ||
std::isnan( m_fIntercept )))
{
- fResult = m_fIntercept * pow( x, m_fSlope );
+ return m_fIntercept * pow( x, m_fSlope );
}
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
}
uno::Sequence< geometry::RealPoint2D > SAL_CALL PotentialRegressionCurveCalculator::getCurveValues(
diff --git a/chart2/source/tools/RegressionCurveCalculator.cxx b/chart2/source/tools/RegressionCurveCalculator.cxx
index a71e607e9f70..ff2f4d13a896 100644
--- a/chart2/source/tools/RegressionCurveCalculator.cxx
+++ b/chart2/source/tools/RegressionCurveCalculator.cxx
@@ -37,17 +37,15 @@ namespace chart
{
RegressionCurveCalculator::RegressionCurveCalculator()
- : m_fCorrelationCoefficient(0.0)
+ : m_fCorrelationCoefficient(std::numeric_limits<double>::quiet_NaN())
, mDegree(2)
, mForceIntercept(false)
- , mInterceptValue(0.0)
+ , mInterceptValue(std::numeric_limits<double>::quiet_NaN())
, mPeriod(2)
, mXName("x")
, mYName("f(x)")
, mnMovingType(0)
{
- rtl::math::setNan( &m_fCorrelationCoefficient );
- rtl::math::setNan( &mInterceptValue );
}
RegressionCurveCalculator::~RegressionCurveCalculator()
diff --git a/chart2/source/tools/Scaling.cxx b/chart2/source/tools/Scaling.cxx
index e10757928a99..b49dab6d6fb9 100644
--- a/chart2/source/tools/Scaling.cxx
+++ b/chart2/source/tools/Scaling.cxx
@@ -18,10 +18,12 @@
*/
#include <Scaling.hxx>
-#include <rtl/math.hxx>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <cppuhelper/supportsservice.hxx>
+#include <cmath>
+#include <limits>
+
namespace com::sun::star::uno { class XComponentContext; }
namespace
@@ -57,12 +59,9 @@ LogarithmicScaling::~LogarithmicScaling()
double SAL_CALL LogarithmicScaling::doScaling( double value )
{
- double fResult;
if( std::isnan( value ) || std::isinf( value ) )
- ::rtl::math::setNan( & fResult );
- else
- fResult = log( value ) / m_fLogOfBase;
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
+ return std::log( value ) / m_fLogOfBase;
}
uno::Reference< XScaling > SAL_CALL LogarithmicScaling::getInverseScaling()
@@ -106,12 +105,9 @@ ExponentialScaling::~ExponentialScaling()
double SAL_CALL ExponentialScaling::doScaling( double value )
{
- double fResult;
if( std::isnan( value ) || std::isinf( value ) )
- ::rtl::math::setNan( & fResult );
- else
- fResult = pow( m_fBase, value );
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
+ return std::pow( m_fBase, value );
}
uno::Reference< XScaling > SAL_CALL ExponentialScaling::getInverseScaling()
@@ -154,12 +150,9 @@ LinearScaling::~LinearScaling()
double SAL_CALL LinearScaling::doScaling( double value )
{
- double fResult;
if( std::isnan( value ) || std::isinf( value ) )
- ::rtl::math::setNan( & fResult );
- else
- fResult = m_fOffset + m_fSlope * value;
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
+ return m_fOffset + m_fSlope * value;
}
uno::Reference< XScaling > SAL_CALL
@@ -205,12 +198,9 @@ PowerScaling::~PowerScaling()
double SAL_CALL PowerScaling::doScaling( double value )
{
- double fResult;
if( std::isnan( value ) || std::isinf( value ) )
- ::rtl::math::setNan( & fResult );
- else
- fResult = pow( value, m_fExponent );
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
+ return std::pow( value, m_fExponent );
}
uno::Reference< XScaling > SAL_CALL
diff --git a/chart2/source/tools/StatisticsHelper.cxx b/chart2/source/tools/StatisticsHelper.cxx
index ef9c141208a1..332843aaa307 100644
--- a/chart2/source/tools/StatisticsHelper.cxx
+++ b/chart2/source/tools/StatisticsHelper.cxx
@@ -22,7 +22,6 @@
#include <ErrorBar.hxx>
#include <unonames.hxx>
-#include <rtl/math.hxx>
#include <rtl/ustrbuf.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/chart2/XDataSeries.hpp>
@@ -33,6 +32,9 @@
#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <tools/diagnose_ex.h>
+#include <cmath>
+#include <limits>
+
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Reference;
using namespace ::com::sun::star;
@@ -60,16 +62,11 @@ double lcl_getVariance( const Sequence< double > & rData, sal_Int32 & rOutValidC
}
}
- double fResult;
if( rOutValidCount == 0 )
- ::rtl::math::setNan( & fResult );
- else
- {
- const double fN = static_cast< double >( rOutValidCount );
- fResult = (fQuadSum - fSum*fSum/fN) / fN;
- }
+ return std::numeric_limits<double>::quiet_NaN();
- return fResult;
+ const double fN = static_cast< double >( rOutValidCount );
+ return (fQuadSum - fSum*fSum/fN) / fN;
}
Reference< chart2::data::XLabeledDataSequence > lcl_getErrorBarLabeledSequence(
@@ -183,20 +180,11 @@ double StatisticsHelper::getStandardError( const Sequence< double > & rData )
{
sal_Int32 nValCount;
double fVar = lcl_getVariance( rData, nValCount );
- double fResult;
-
- if( nValCount == 0 ||
- std::isnan( fVar ))
- {
- ::rtl::math::setNan( & fResult );
- }
- else
- {
- // standard-deviation / sqrt(n)
- fResult = sqrt( fVar ) / sqrt( double(nValCount) );
- }
- return fResult;
+ if( nValCount == 0 || std::isnan( fVar ))
+ return std::numeric_limits<double>::quiet_NaN();
+ // standard-deviation / sqrt(n)
+ return sqrt( fVar ) / sqrt( double(nValCount) );
}
Reference< chart2::data::XLabeledDataSequence > StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
@@ -238,8 +226,7 @@ double StatisticsHelper::getErrorFromDataSource(
bool bPositiveValue,
bool bYError /* = true */ )
{
- double fResult = 0.0;
- ::rtl::math::setNan( & fResult );
+ double fResult = std::numeric_limits<double>::quiet_NaN();
Reference< chart2::data::XDataSequence > xValues(
StatisticsHelper::getErrorDataSequenceFromDataSource( xDataSource, bPositiveValue, bYError ));
diff --git a/chart2/source/view/axes/DateScaling.cxx b/chart2/source/view/axes/DateScaling.cxx
index a926b5a43c51..6f352c486517 100644
--- a/chart2/source/view/axes/DateScaling.cxx
+++ b/chart2/source/view/axes/DateScaling.cxx
@@ -22,6 +22,8 @@
#include <rtl/math.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <limits>
+
namespace
{
@@ -55,7 +57,7 @@ double SAL_CALL DateScaling::doScaling( double value )
{
double fResult(value);
if( std::isnan( value ) || std::isinf( value ) )
- ::rtl::math::setNan( & fResult );
+ return std::numeric_limits<double>::quiet_NaN();
else
{
Date aDate(m_aNullDate);
@@ -131,7 +133,7 @@ double SAL_CALL InverseDateScaling::doScaling( double value )
{
double fResult(value);
if( std::isnan( value ) || std::isinf( value ) )
- ::rtl::math::setNan( & fResult );
+ return std::numeric_limits<double>::quiet_NaN();
else
{
switch( m_nTimeUnit )
diff --git a/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx b/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx
index 2c9264786edf..422d08e64029 100644
--- a/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx
+++ b/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx
@@ -23,6 +23,8 @@
#include <rtl/math.hxx>
+#include <limits>
+
namespace chart
{
using namespace ::com::sun::star;
@@ -56,7 +58,7 @@ double MergedMinimumAndMaximumSupplier::getMinimumX()
fGlobalExtremum=fLocalExtremum;
}
if(std::isinf(fGlobalExtremum))
- ::rtl::math::setNan(&fGlobalExtremum);
+ return std::numeric_limits<double>::quiet_NaN();
return fGlobalExtremum;
}
@@ -71,7 +73,7 @@ double MergedMinimumAndMaximumSupplier::getMaximumX()
fGlobalExtremum=fLocalExtremum;
}
if(std::isinf(fGlobalExtremum))
- ::rtl::math::setNan(&fGlobalExtremum);
+ return std::numeric_limits<double>::quiet_NaN();
return fGlobalExtremum;
}
@@ -86,7 +88,7 @@ double MergedMinimumAndMaximumSupplier::getMinimumYInRange( double fMinimumX, do
fGlobalExtremum=fLocalExtremum;
}
if(std::isinf(fGlobalExtremum))
- ::rtl::math::setNan(&fGlobalExtremum);
+ return std::numeric_limits<double>::quiet_NaN();
return fGlobalExtremum;
}
@@ -101,7 +103,7 @@ double MergedMinimumAndMaximumSupplier::getMaximumYInRange( double fMinimumX, do
fGlobalExtremum=fLocalExtremum;
}
if(std::isinf(fGlobalExtremum))
- ::rtl::math::setNan(&fGlobalExtremum);
+ return std::numeric_limits<double>::quiet_NaN();
return fGlobalExtremum;
}
@@ -116,7 +118,7 @@ double MergedMinimumAndMaximumSupplier::getMinimumZ()
fGlobalExtremum=fLocalExtremum;
}
if(std::isinf(fGlobalExtremum))
- ::rtl::math::setNan(&fGlobalExtremum);
+ return std::numeric_limits<double>::quiet_NaN();
return fGlobalExtremum;
}
@@ -131,7 +133,7 @@ double MergedMinimumAndMaximumSupplier::getMaximumZ()
fGlobalExtremum=fLocalExtremum;
}
if(std::isinf(fGlobalExtremum))
- ::rtl::math::setNan(&fGlobalExtremum);
+ return std::numeric_limits<double>::quiet_NaN();
return fGlobalExtremum;
}
diff --git a/chart2/source/view/axes/ScaleAutomatism.cxx b/chart2/source/view/axes/ScaleAutomatism.cxx
index 7557f9b3d95b..f433a6bd076b 100644
--- a/chart2/source/view/axes/ScaleAutomatism.cxx
+++ b/chart2/source/view/axes/ScaleAutomatism.cxx
@@ -109,8 +109,8 @@ ScaleAutomatism::ScaleAutomatism( const ScaleData& rSourceScale, const Date& rNu
void ScaleAutomatism::resetValueRange( )
{
- ::rtl::math::setNan( &m_fValueMinimum );
- ::rtl::math::setNan( &m_fValueMaximum );
+ m_fValueMinimum = std::numeric_limits<double>::quiet_NaN();
+ m_fValueMaximum = std::numeric_limits<double>::quiet_NaN();
}
void ScaleAutomatism::expandValueRange( double fMinimum, double fMaximum )
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index fcb3391c693c..e2b983d7d63a 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -44,6 +44,7 @@
#include <basegfx/numeric/ftools.hxx>
#include <algorithm>
+#include <limits>
#include <memory>
using namespace ::com::sun::star;
@@ -1109,18 +1110,15 @@ double VCartesianAxis::getLabelLineIntersectionValue() const
double VCartesianAxis::getExtraLineIntersectionValue() const
{
- double fNan;
- rtl::math::setNan(&fNan);
-
if( !m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis )
- return fNan;
+ return std::numeric_limits<double>::quiet_NaN();
double fMin = (m_nDimensionIndex==1) ? m_pPosHelper->getLogicMinX() : m_pPosHelper->getLogicMinY();
double fMax = (m_nDimensionIndex==1) ? m_pPosHelper->getLogicMaxX() : m_pPosHelper->getLogicMaxY();
if( *m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis <= fMin
|| *m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis >= fMax )
- return fNan;
+ return std::numeric_limits<double>::quiet_NaN();
return *m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis;
}
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 9421e94e6e9e..37b90cdfdbc0 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -36,7 +36,6 @@
#include <com/sun/star/chart/DataLabelPlacement.hpp>
#include <com/sun/star/chart/MissingValueTreatment.hpp>
-#include <rtl/math.hxx>
#include <sal/log.hxx>
#include <osl/diagnose.h>
@@ -45,10 +44,11 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <officecfg/Office/Compatibility.hxx>
+#include <limits>
+
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::rtl::math;
using namespace ::com::sun::star::chart2;
AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
@@ -589,10 +589,10 @@ struct FormerPoint
: m_fX(fX), m_fY(fY), m_fZ(fZ)
{}
FormerPoint()
+ : m_fX(std::numeric_limits<double>::quiet_NaN())
+ , m_fY(std::numeric_limits<double>::quiet_NaN())
+ , m_fZ(std::numeric_limits<double>::quiet_NaN())
{
- ::rtl::math::setNan( &m_fX );
- ::rtl::math::setNan( &m_fY );
- ::rtl::math::setNan( &m_fZ );
}
double m_fX;
diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx
index ccdb6a9bc58d..02532136b075 100644
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -394,11 +394,11 @@ struct FormerBarPoint
: m_fX(fX), m_fUpperY(fUpperY), m_fLowerY(fLowerY), m_fZ(fZ)
{}
FormerBarPoint()
+ : m_fX(std::numeric_limits<double>::quiet_NaN())
+ , m_fUpperY(std::numeric_limits<double>::quiet_NaN())
+ , m_fLowerY(std::numeric_limits<double>::quiet_NaN())
+ , m_fZ(std::numeric_limits<double>::quiet_NaN())
{
- ::rtl::math::setNan( &m_fX );
- ::rtl::math::setNan( &m_fUpperY );
- ::rtl::math::setNan( &m_fLowerY );
- ::rtl::math::setNan( &m_fZ );
}
double m_fX;
diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx
index 9ad349b9f455..d5141be5cb58 100644
--- a/chart2/source/view/charttypes/BubbleChart.cxx
+++ b/chart2/source/view/charttypes/BubbleChart.cxx
@@ -24,16 +24,16 @@
#include <LabelPositionHelper.hxx>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
-#include <rtl/math.hxx>
#include <sal/log.hxx>
#include <osl/diagnose.h>
#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <limits>
+
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::rtl::math;
using namespace ::com::sun::star::chart2;
BubbleChart::BubbleChart( const uno::Reference<XChartType>& xChartTypeModel
@@ -145,10 +145,10 @@ struct FormerPoint
: m_fX(fX), m_fY(fY), m_fZ(fZ)
{}
FormerPoint()
+ : m_fX(std::numeric_limits<double>::quiet_NaN())
+ , m_fY(std::numeric_limits<double>::quiet_NaN())
+ , m_fZ(std::numeric_limits<double>::quiet_NaN())
{
- ::rtl::math::setNan( &m_fX );
- ::rtl::math::setNan( &m_fY );
- ::rtl::math::setNan( &m_fZ );
}
double m_fX;
diff --git a/chart2/source/view/charttypes/NetChart.cxx b/chart2/source/view/charttypes/NetChart.cxx
index da270d37de48..2db1dd5512ae 100644
--- a/chart2/source/view/charttypes/NetChart.cxx
+++ b/chart2/source/view/charttypes/NetChart.cxx
@@ -32,16 +32,16 @@
#include <com/sun/star/chart/DataLabelPlacement.hpp>
#include <com/sun/star/chart/MissingValueTreatment.hpp>
-#include <rtl/math.hxx>
#include <osl/diagnose.h>
#include <com/sun/star/drawing/XShapes.hpp>
#include <officecfg/Office/Compatibility.hxx>
+#include <limits>
+
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::rtl::math;
using namespace ::com::sun::star::chart2;
NetChart::NetChart( const uno::Reference<XChartType>& xChartTypeModel
@@ -301,10 +301,11 @@ struct FormerPoint
: m_fX(fX), m_fY(fY), m_fZ(fZ)
{}
FormerPoint()
+ : m_fX(std::numeric_limits<double>::quiet_NaN())
+ , m_fY(std::numeric_limits<double>::quiet_NaN())
+ , m_fZ(std::numeric_limits<double>::quiet_NaN())
+
{
- ::rtl::math::setNan( &m_fX );
- ::rtl::math::setNan( &m_fY );
- ::rtl::math::setNan( &m_fZ );
}
double m_fX;
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index e77a7964ee71..08f94d00f513 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -34,12 +34,12 @@
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <rtl/math.hxx>
#include <sal/log.hxx>
#include <osl/diagnose.h>
#include <tools/diagnose_ex.h>
#include <tools/helpers.hxx>
+#include <limits>
#include <memory>
using namespace ::com::sun::star;
@@ -198,9 +198,8 @@ PieChart::PieChart( const uno::Reference<XChartType>& xChartTypeModel
, m_pPosHelper( new PiePositionHelper( (m_nDimension==3) ? 0.0 : 90.0 ) )
, m_bUseRings(false)
, m_bSizeExcludesLabelsAndExplodedSegments(bExcludingPositioning)
+ , m_fMaxOffset(std::numeric_limits<double>::quiet_NaN())
{
- ::rtl::math::setNan(&m_fMaxOffset);
-
PlotterBase::m_pPosHelper = m_pPosHelper.get();
VSeriesPlotter::m_pMainPosHelper = m_pPosHelper.get();
m_pPosHelper->m_fRadiusOffset = 0.0;
@@ -711,7 +710,7 @@ void PieChart::createShapes()
nExplodeableSlot = m_aZSlots.front().size()-1;
m_aLabelInfoList.clear();
- ::rtl::math::setNan(&m_fMaxOffset);
+ m_fMaxOffset = std::numeric_limits<double>::quiet_NaN();
sal_Int32 n3DRelativeHeight = 100;
uno::Reference< beans::XPropertySet > xPropertySet( m_xChartTypeModel, uno::UNO_QUERY );
if ( (m_nDimension==3) && xPropertySet.is())
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 2c62b46cc678..f69bb8a10dd7 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <limits>
#include <memory>
#include <VSeriesPlotter.hxx>
#include <BaseGFXHelper.hxx>
@@ -808,8 +809,7 @@ double lcl_getErrorBarLogicLength(
bool bPositive,
bool bYError )
{
- double fResult;
- ::rtl::math::setNan( & fResult );
+ double fResult = std::numeric_limits<double>::quiet_NaN();
try
{
switch( nErrorBarStyle )
@@ -1726,7 +1726,7 @@ double VSeriesPlotter::getMinimumYInRange( double fMinimumX, double fMaximumX, s
}
}
if(std::isinf(fMinimum))
- ::rtl::math::setNan(&fMinimum);
+ return std::numeric_limits<double>::quiet_NaN();
return fMinimum;
}
@@ -1759,7 +1759,7 @@ double VSeriesPlotter::getMaximumYInRange( double fMinimumX, double fMaximumX, s
}
}
if(std::isinf(fMaximum))
- ::rtl::math::setNan(&fMaximum);
+ return std::numeric_limits<double>::quiet_NaN();
return fMaximum;
}
@@ -1833,9 +1833,9 @@ void VSeriesPlotter::getMinimumAndMaximumX( double& rfMinimum, double& rfMaximum
}
}
if(std::isinf(rfMinimum))
- ::rtl::math::setNan(&rfMinimum);
+ rfMinimum = std::numeric_limits<double>::quiet_NaN();
if(std::isinf(rfMaximum))
- ::rtl::math::setNan(&rfMaximum);
+ rfMaximum = std::numeric_limits<double>::quiet_NaN();
}
void VSeriesPlotter::getMinimumAndMaximumYInContinuousXRange( double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const
@@ -1856,9 +1856,9 @@ void VSeriesPlotter::getMinimumAndMaximumYInContinuousXRange( double& rfMinY, do
}
}
if(std::isinf(rfMinY))
- ::rtl::math::setNan(&rfMinY);
+ rfMinY = std::numeric_limits<double>::quiet_NaN();
if(std::isinf(rfMaxY))
- ::rtl::math::setNan(&rfMaxY);
+ rfMaxY = std::numeric_limits<double>::quiet_NaN();
}
sal_Int32 VSeriesPlotter::getPointCount() const
@@ -1944,9 +1944,9 @@ void VDataSeriesGroup::getMinimumAndMaximumX( double& rfMinimum, double& rfMaxim
}
}
if(std::isinf(rfMinimum))
- ::rtl::math::setNan(&rfMinimum);
+ rfMinimum = std::numeric_limits<double>::quiet_NaN();
if(std::isinf(rfMaximum))
- ::rtl::math::setNan(&rfMaximum);
+ rfMaximum = std::numeric_limits<double>::quiet_NaN();
}
namespace {
@@ -2007,14 +2007,15 @@ public:
void getTotalRange(double& rfMin, double& rfMax) const
{
- rtl::math::setNan(&rfMin);
- rtl::math::setNan(&rfMax);
-
TotalStoreType aStore;
getTotalStore(aStore);
if (aStore.empty())
+ {
+ rfMin = std::numeric_limits<double>::quiet_NaN();
+ rfMax = std::numeric_limits<double>::quiet_NaN();
return;
+ }
TotalStoreType::const_iterator it = aStore.begin(), itEnd = aStore.end();
rfMin = it->second.first;
@@ -2085,8 +2086,8 @@ private:
void VDataSeriesGroup::getMinimumAndMaximumYInContinuousXRange(
double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const
{
- ::rtl::math::setNan(&rfMinY);
- ::rtl::math::setNan(&rfMaxY);
+ rfMinY = std::numeric_limits<double>::quiet_NaN();
+ rfMaxY = std::numeric_limits<double>::quiet_NaN();
if (m_aSeriesVector.empty())
// No data series. Bail out.
@@ -2145,12 +2146,11 @@ void VDataSeriesGroup::calculateYMinAndMaxForCategory( sal_Int32 nCategoryIndex
return;
}
- double fTotalSum, fPositiveSum, fNegativeSum, fFirstPositiveY, fFirstNegativeY;
- ::rtl::math::setNan( &fTotalSum );
- ::rtl::math::setNan( &fPositiveSum );
- ::rtl::math::setNan( &fNegativeSum );
- ::rtl::math::setNan( &fFirstPositiveY );
- ::rtl::math::setNan( &fFirstNegativeY );
+ double fTotalSum = std::numeric_limits<double>::quiet_NaN();
+ double fPositiveSum = std::numeric_limits<double>::quiet_NaN();
+ double fNegativeSum = std::numeric_limits<double>::quiet_NaN();
+ double fFirstPositiveY = std::numeric_limits<double>::quiet_NaN();
+ double fFirstNegativeY = std::numeric_limits<double>::quiet_NaN();
if( bSeparateStackingForDifferentSigns )
{
@@ -2233,8 +2233,8 @@ void VDataSeriesGroup::calculateYMinAndMaxForCategoryRange(
nEndCategoryIndex=0;
for( sal_Int32 nCatIndex = nStartCategoryIndex; nCatIndex <= nEndCategoryIndex; nCatIndex++ )
{
- double fMinimumY; ::rtl::math::setNan(&fMinimumY);
- double fMaximumY; ::rtl::math::setNan(&fMaximumY);
+ double fMinimumY = std::numeric_limits<double>::quiet_NaN();
+ double fMaximumY = std::numeric_limits<double>::quiet_NaN();
calculateYMinAndMaxForCategory( nCatIndex
, bSeparateStackingForDifferentSigns, fMinimumY, fMaximumY, nAxisIndex );
diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx
index 247fe41a2d27..87abdb2810c8 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <limits>
#include <memory>
#include <VDataSeries.hxx>
#include <ObjectIdentifier.hxx>
@@ -67,12 +68,7 @@ double VDataSequence::getValue( sal_Int32 index ) const
{
if( 0<=index && index<Doubles.getLength() )
return Doubles[index];
- else
- {
- double fNan;
- ::rtl::math::setNan( & fNan );
- return fNan;
- }
+ return std::numeric_limits<double>::quiet_NaN();
}
sal_Int32 VDataSequence::detectNumberFormatKey( sal_Int32 index ) const
@@ -152,8 +148,8 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
, m_pValueSequenceForDataLabelNumberFormatDetection(&m_aValues_Y)
- , m_fXMeanValue(1.0)
- , m_fYMeanValue(1.0)
+ , m_fXMeanValue(std::numeric_limits<double>::quiet_NaN())
+ , m_fYMeanValue(std::numeric_limits<double>::quiet_NaN())
, m_aAttributedDataPointIndexList()
@@ -171,9 +167,6 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
, mpOldSeries(nullptr)
, mnPercent(0.0)
{
- ::rtl::math::setNan( & m_fXMeanValue );
- ::rtl::math::setNan( & m_fYMeanValue );
-
uno::Reference<data::XDataSource> xDataSource( xDataSeries, uno::UNO_QUERY );
uno::Sequence< uno::Reference<
@@ -272,14 +265,14 @@ void VDataSeries::doSortByXValues()
//prepare a vector for sorting
std::vector< std::vector< double > > aTmp;//outer vector are points, inner vector are the different values of the point
- double fNan;
- ::rtl::math::setNan( & fNan );
sal_Int32 nPointIndex = 0;
for( nPointIndex=0; nPointIndex < m_nPointCount; nPointIndex++ )
{
aTmp.push_back(
- { ((nPointIndex < m_aValues_X.Doubles.getLength()) ? m_aValues_X.Doubles[nPointIndex] : fNan),
- ((nPointIndex < m_aValues_Y.Doubles.getLength()) ? m_aValues_Y.Doubles[nPointIndex] : fNan)
+ { ((nPointIndex < m_aValues_X.Doubles.getLength()) ? m_aValues_X.Doubles[nPointIndex]
+ : std::numeric_limits<double>::quiet_NaN()),
+ ((nPointIndex < m_aValues_Y.Doubles.getLength()) ? m_aValues_Y.Doubles[nPointIndex]
+ : std::numeric_limits<double>::quiet_NaN())
}
);
}
@@ -435,7 +428,7 @@ void VDataSeries::setAttachedAxisIndex( sal_Int32 nAttachedAxisIndex )
double VDataSeries::getXValue( sal_Int32 index ) const
{
- double fRet = 0.0;
+ double fRet = std::numeric_limits<double>::quiet_NaN();
if(m_aValues_X.is())
{
if( 0<=index && index<m_aValues_X.getLength() )
@@ -447,16 +440,12 @@ double VDataSeries::getXValue( sal_Int32 index ) const
fRet = nOldVal + (fRet - nOldVal) * mnPercent;
}
}
- else
- ::rtl::math::setNan( &fRet );
}
else
{
// #i70133# always return correct X position - needed for short data series
if( 0<=index /*&& index < m_nPointCount*/ )
fRet = index+1;//first category (index 0) matches with real number 1.0
- else
- ::rtl::math::setNan( &fRet );
}
lcl_maybeReplaceNanWithZero( fRet, getMissingValueTreatment() );
return fRet;
@@ -464,7 +453,7 @@ double VDataSeries::getXValue( sal_Int32 index ) const
double VDataSeries::getYValue( sal_Int32 index ) const
{
- double fRet = 0.0;
+ double fRet = std::numeric_limits<double>::quiet_NaN();
if(m_aValues_Y.is())
{
if( 0<=index && index<m_aValues_Y.getLength() )
@@ -476,16 +465,12 @@ double VDataSeries::getYValue( sal_Int32 index ) const
fRet = nOldVal + (fRet - nOldVal) * mnPercent;
}
}
- else
- ::rtl::math::setNan( &fRet );
}
else
{
// #i70133# always return correct X position - needed for short data series
if( 0<=index /*&& index < m_nPointCount*/ )
fRet = index+1;//first category (index 0) matches with real number 1.0
- else
- ::rtl::math::setNan( &fRet );
}
lcl_maybeReplaceNanWithZero( fRet, getMissingValueTreatment() );
return fRet;
@@ -493,8 +478,8 @@ double VDataSeries::getYValue( sal_Int32 index ) const
void VDataSeries::getMinMaxXValue(double& fMin, double& fMax) const
{
- rtl::math::setNan( &fMax );
- rtl::math::setNan( &fMin );
+ fMax = std::numeric_limits<double>::quiet_NaN();
+ fMin = std::numeric_limits<double>::quiet_NaN();
uno::Sequence< double > aValuesX = getAllX();
@@ -701,7 +686,7 @@ double VDataSeries::getMinimumofAllDifferentYValues( sal_Int32 index ) const
}
if( std::isinf(fMin) )
- ::rtl::math::setNan(&fMin);
+ return std::numeric_limits<double>::quiet_NaN();
return fMin;
}
@@ -737,7 +722,7 @@ double VDataSeries::getMaximumofAllDifferentYValues( sal_Int32 index ) const
}
if( std::isinf(fMax) )
- ::rtl::math::setNan(&fMax);
+ return std::numeric_limits<double>::quiet_NaN();
return fMax;
}
@@ -1112,11 +1097,7 @@ double VDataSeries::getValueByProperty( sal_Int32 nIndex, const OUString& rPropN
{
auto const itr = m_PropertyMap.find(rPropName);
if (itr == m_PropertyMap.end())
- {
- double fNan;
- ::rtl::math::setNan( &fNan );
- return fNan;
- }
+ return std::numeric_limits<double>::quiet_NaN();
const VDataSequence* pData = &itr->second;
double fValue = pData->getValue(nIndex);
diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
index 2098f513f343..6a050770d8a0 100644
--- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx
+++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
@@ -738,11 +738,7 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(bool _bHasCategor
aValue.fill( column.nResultSetPosition, column.nDataType, xRow );
if ( aValue.isNull() )
- {
- double nValue;
- ::rtl::math::setNan( &nValue );
- aRow.push_back( nValue );
- }
+ aRow.push_back( std::numeric_limits<double>::quiet_NaN() );
else
aRow.push_back( aValue.getDouble() );
}
diff --git a/include/formula/errorcodes.hxx b/include/formula/errorcodes.hxx
index 12696bb0579d..1a96a0c70223 100644
--- a/include/formula/errorcodes.hxx
+++ b/include/formula/errorcodes.hxx
@@ -24,6 +24,8 @@
#include <sal/mathconf.h>
#include <sal/types.h>
+#include <limits>
+
// Store as 16-bits, since error values are stored in tokens and formula results,
// and that can matter
enum class FormulaError : sal_uInt16
@@ -96,7 +98,7 @@ enum class FormulaError : sal_uInt16
inline double CreateDoubleError( FormulaError nErr )
{
sal_math_Double smVal;
- ::rtl::math::setNan( &smVal.value );
+ smVal.value = std::numeric_limits<double>::quiet_NaN();
smVal.nan_parts.fraction_lo = static_cast<unsigned>(nErr);
return smVal.value;
}
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 12a996a45161..2a0d335ca86b 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -27,6 +27,7 @@
#include <drawingml/chart/typegroupconverter.hxx>
#include <cstdio>
+#include <limits>
#include <com/sun/star/awt/Gradient.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
@@ -104,7 +105,6 @@
#include <set>
#include <unordered_set>
-#include <rtl/math.hxx>
#include <o3tl/temporary.hxx>
#include <o3tl/sorted_vector.hxx>
@@ -416,8 +416,6 @@ static void lcl_fillCategoriesIntoStringVector(
static ::std::vector< double > lcl_getAllValuesFromSequence( const Reference< chart2::data::XDataSequence > & xSeq )
{
- double fNan = 0.0;
- ::rtl::math::setNan( &fNan );
::std::vector< double > aResult;
Reference< chart2::data::XNumericalDataSequence > xNumSeq( xSeq, uno::UNO_QUERY );
@@ -429,7 +427,7 @@ static ::std::vector< double > lcl_getAllValuesFromSequence( const Reference< ch
else if( xSeq.is())
{
Sequence< uno::Any > aAnies( xSeq->getData());
- aResult.resize( aAnies.getLength(), fNan );
+ aResult.resize( aAnies.getLength(), std::numeric_limits<double>::quiet_NaN() );
for( sal_Int32 i=0; i<aAnies.getLength(); ++i )
aAnies[i] >>= aResult[i];
}
diff --git a/sc/inc/PivotTableDataSequence.hxx b/sc/inc/PivotTableDataSequence.hxx
index 09d43f09898f..43128b689b3c 100644
--- a/sc/inc/PivotTableDataSequence.hxx
+++ b/sc/inc/PivotTableDataSequence.hxx
@@ -22,7 +22,8 @@
#include <svl/lstner.hxx>
#include <svl/itemprop.hxx>
#include <cppuhelper/implbase.hxx>
-#include <rtl/math.hxx>
+
+#include <limits>
class ScDocument;
@@ -44,12 +45,11 @@ struct ValueAndFormat
sal_uInt32 m_nNumberFormat;
explicit ValueAndFormat()
- : m_fValue(0.0)
+ : m_fValue(std::numeric_limits<double>::quiet_NaN())
, m_aString()
, m_eType(ValueType::Empty)
, m_nNumberFormat(0)
{
- rtl::math::setNan(&m_fValue);
}
explicit ValueAndFormat(double fValue, sal_uInt32 nNumberFormat)
@@ -60,12 +60,11 @@ struct ValueAndFormat
{}
explicit ValueAndFormat(OUString const & rString)
- : m_fValue(0.0)
+ : m_fValue(std::numeric_limits<double>::quiet_NaN())
, m_aString(rString)
, m_eType(ValueType::String)
, m_nNumberFormat(0)
{
- rtl::math::setNan(&m_fValue);
}
};
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 9a7a3e34d623..75e96eba3c70 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -90,6 +90,7 @@
#include <sfx2/sfxsids.hrc>
#include <iostream>
+#include <limits>
#include <memory>
#include <vector>
@@ -2143,8 +2144,7 @@ void Test::testMatrix()
pMat->PutDouble(2.3, 2, 1);
pMat->PutDouble(-20, 2, 2);
- double fNaN;
- rtl::math::setNan(&fNaN);
+ static const double fNaN = std::numeric_limits<double>::quiet_NaN();
std::vector<double> aDoubles;
pMat->GetDoubleArray(aDoubles);
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 21217e9cbbe1..21ae683ae443 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -64,8 +64,6 @@
#include <memory>
#include <numeric>
-#include <math.h>
-
// factor from font size to optimal cell height (text width)
#define SC_ROT_BREAK_FACTOR 6
@@ -2472,8 +2470,6 @@ bool appendToBlock(
{
svl::SharedStringPool& rPool = pDoc->GetSharedStringPool();
size_t nLenRemain = nArrayLen - nPos;
- double fNan;
- rtl::math::setNan(&fNan);
for (sc::CellStoreType::iterator it = _it; it != itEnd; ++it)
{
@@ -2627,9 +2623,6 @@ copyFirstFormulaBlock(
sc::FormulaGroupContext& rCxt, const sc::CellStoreType::iterator& itBlk, size_t nArrayLen,
SCTAB nTab, SCCOL nCol )
{
- double fNan;
- rtl::math::setNan(&fNan);
-
size_t nLen = std::min(itBlk->size, nArrayLen);
sc::formula_block::iterator it = sc::formula_block::begin(*itBlk->data);
@@ -2661,7 +2654,8 @@ copyFirstFormulaBlock(
if (!pNumArray)
{
rCxt.m_NumArrays.push_back(
- std::make_unique<sc::FormulaGroupContext::NumArrayType>(nArrayLen, fNan));
+ std::make_unique<sc::FormulaGroupContext::NumArrayType>(nArrayLen,
+ std::numeric_limits<double>::quiet_NaN()));
pNumArray = rCxt.m_NumArrays.back().get();
}
@@ -2741,9 +2735,6 @@ formula::VectorRefArray ScColumn::FetchVectorRefArray( SCROW nRow1, SCROW nRow2
// So temporarily block the discarding.
ProtectFormulaGroupContext protectContext(&GetDoc());
- double fNan;
- rtl::math::setNan(&fNan);
-
// We need to fetch all cell values from row 0 to nRow2 for caching purposes.
sc::CellStoreType::iterator itBlk = maCells.begin();
switch (itBlk->type)
@@ -2763,7 +2754,8 @@ formula::VectorRefArray ScColumn::FetchVectorRefArray( SCROW nRow1, SCROW nRow2
rCxt.m_NumArrays.push_back(
std::make_unique<sc::FormulaGroupContext::NumArrayType>(it, itEnd));
sc::FormulaGroupContext::NumArrayType& rArray = *rCxt.m_NumArrays.back();
- rArray.resize(nRow2+1, fNan); // allocate to the requested length.
+ // allocate to the requested length.
+ rArray.resize(nRow2+1, std::numeric_limits<double>::quiet_NaN());
pColArray = rCxt.setCachedColArray(nTab, nCol, &rArray, nullptr);
if (!pColArray)
@@ -2877,7 +2869,8 @@ formula::VectorRefArray ScColumn::FetchVectorRefArray( SCROW nRow1, SCROW nRow2
{
// Fill the whole length with NaN's.
rCxt.m_NumArrays.push_back(
- std::make_unique<sc::FormulaGroupContext::NumArrayType>(nRow2+1, fNan));
+ std::make_unique<sc::FormulaGroupContext::NumArrayType>(nRow2+1,
+ std::numeric_limits<double>::quiet_NaN()));
sc::FormulaGroupContext::NumArrayType& rArray = *rCxt.m_NumArrays.back();
pColArray = rCxt.setCachedColArray(nTab, nCol, &rArray, nullptr);
if (!pColArray)
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index deb9a8eaa6a1..7f85c52493cc 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -47,6 +47,7 @@
#include <osl/diagnose.h>
#include <algorithm>
+#include <limits>
#include <vector>
using ::rtl::math::approxEqual;
@@ -745,10 +746,10 @@ bool ScDBQueryDataIterator::DataAccessMatrix::isValidQuery(SCROW nRow, const ScM
return std::find(aResults.begin(), aResults.end(), true) != aResults.end();
}
-ScDBQueryDataIterator::Value::Value() :
- mnError(FormulaError::NONE), mbIsNumber(true)
+ScDBQueryDataIterator::Value::Value()
+ : mfValue(std::numeric_limits<double>::quiet_NaN())
+ , mnError(FormulaError::NONE), mbIsNumber(true)
{
- ::rtl::math::setNan(&mfValue);
}
ScDBQueryDataIterator::ScDBQueryDataIterator(ScDocument& rDocument, const ScInterpreterContext& rContext, std::unique_ptr<ScDBQueryParamBase> pParam) :
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index d60b41d143e8..f3a494694003 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -1355,30 +1355,28 @@ public:
double ScDPObject::GetPivotData(const OUString& rDataFieldName, std::vector<sheet::DataPilotFieldFilter>& rFilters)
{
- double fRet;
- rtl::math::setNan(&fRet);
if (!mbEnableGetPivotData)
- return fRet;
+ return std::numeric_limits<double>::quiet_NaN();
CreateObjects();
std::vector<const ScDPSaveDimension*> aDataDims;
pSaveData->GetAllDimensionsByOrientation(sheet::DataPilotFieldOrientation_DATA, aDataDims);
if (aDataDims.empty())
- return fRet;
+ return std::numeric_limits<double>::quiet_NaN();
std::vector<const ScDPSaveDimension*>::iterator it = std::find_if(
aDataDims.begin(), aDataDims.end(),
FindByName(ScGlobal::getCharClassPtr()->uppercase(rDataFieldName)));
if (it == aDataDims.end())
- return fRet;
+ return std::numeric_limits<double>::quiet_NaN();
size_t nDataIndex = std::distance(aDataDims.begin(), it);
uno::Reference<sheet::XDataPilotResults> xDPResults(xSource, uno::UNO_QUERY);
if (!xDPResults.is())
- return fRet;
+ return std::numeric_limits<double>::quiet_NaN();
// Dimensions must be sorted in order of appearance, and row dimensions
// must come before column dimensions.
@@ -1391,7 +1389,7 @@ double ScDPObject::GetPivotData(const OUString& rDataFieldName, std::vector<shee
uno::Sequence<double> aRes = xDPResults->getFilteredResults(aFilters);
if (static_cast<sal_Int32>(nDataIndex) >= aRes.getLength())
- return fRet;
+ return std::numeric_limits<double>::quiet_NaN();
return aRes[nDataIndex];
}
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index fe54b7c1086c..ca9b214b5605 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -58,6 +58,7 @@
#include <com/sun/star/sheet/XMembersAccess.hpp>
#include <com/sun/star/sheet/XMembersSupplier.hpp>
+#include <limits>
#include <string_view>
#include <vector>
@@ -486,9 +487,7 @@ uno::Sequence<sheet::MemberResult> getVisiblePageMembersAsResults( const uno::Re
if (bVisible)
{
/* TODO: any numeric value to obtain? */
- double fValue;
- rtl::math::setNan(&fValue);
- aRes.emplace_back(rName, aCaption, 0, fValue);
+ aRes.emplace_back(rName, aCaption, 0, std::numeric_limits<double>::quiet_NaN());
}
}
diff --git a/sc/source/core/data/dpresfilter.cxx b/sc/source/core/data/dpresfilter.cxx
index 346cbef8b4f1..9c6c25413cf2 100644
--- a/sc/source/core/data/dpresfilter.cxx
+++ b/sc/source/core/data/dpresfilter.cxx
@@ -11,13 +11,14 @@
#include <global.hxx>
#include <unotools/charclass.hxx>
-#include <rtl/math.hxx>
#include <sal/log.hxx>
#include <o3tl/hash_combine.hxx>
#include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
#include <com/sun/star/uno/Sequence.hxx>
+#include <limits>
+
using namespace com::sun::star;
using namespace std;
@@ -171,7 +172,7 @@ void ScDPResultTree::add(
else
{
// This name pair already exists. Set the value to NaN.
- rtl::math::setNan(&it->second);
+ it->second = std::numeric_limits<double>::quiet_NaN();
}
}
@@ -259,9 +260,7 @@ double ScDPResultTree::getLeafResult(const css::sheet::DataPilotFieldFilter& rFi
return it->second;
// Not found. Return an NaN.
- double fNan;
- rtl::math::setNan(&fNan);
- return fNan;
+ return std::numeric_limits<double>::quiet_NaN();
}
#if DEBUG_PIVOT_TABLE
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index b3d1d894dd2a..46311e3570a8 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -40,6 +40,7 @@
#include <math.h>
#include <float.h>
#include <algorithm>
+#include <limits>
#include <memory>
#include <unordered_map>
@@ -1335,8 +1336,7 @@ void ScDPResultMember::FillMemberResults(
OSL_ENSURE( rPos+nSize <= pSequences->getLength(), "bumm" );
bool bIsNumeric = false;
- double fValue;
- rtl::math::setNan(&fValue);
+ double fValue = std::numeric_limits<double>::quiet_NaN();
OUString aName;
if ( pMemberName ) // if pMemberName != NULL, use instead of real member name
{
@@ -1498,7 +1498,7 @@ void ScDPResultMember::FillMemberResults(
}
}
- rtl::math::setNan(&fValue); /* TODO: any numeric value to obtain? */
+ fValue = std::numeric_limits<double>::quiet_NaN(); /* TODO: any numeric value to obtain? */
pArray[rPos].Name = aName;
pArray[rPos].Caption = aSubStr;
pArray[rPos].Flags = ( pArray[rPos].Flags |
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 92083e2a2cd1..9058a42c948a 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -17,7 +17,6 @@
#include <formula/vectortoken.hxx>
#include <scmatrix.hxx>
#include <sal/log.hxx>
-#include <rtl/math.hxx>
#include <opencl/openclwrapper.hxx>
#include <opencl/OpenCLZone.hxx>
@@ -31,6 +30,8 @@
#include "op_spreadsheet.hxx"
#include "op_addin.hxx"
+#include <limits>
+
#include <com/sun/star/sheet/FormulaLanguage.hpp>
// FIXME: The idea that somebody would bother to (now and then? once a year? once a month?) manually
@@ -322,7 +323,7 @@ size_t VectorRef::Marshal( cl_kernel k, int argno, int, cl_program )
throw OpenCLError("clEnqueueMapBuffer", err, __FILE__, __LINE__);
for (size_t i = 0; i < szHostBuffer / sizeof(double); i++)
- rtl::math::setNan(&pNanBuffer[i]);
+ pNanBuffer[i] = std::numeric_limits<double>::quiet_NaN();
err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, mpClmem,
pNanBuffer, 0, nullptr, nullptr);
// FIXME: Is it intentional to not throw an OpenCLError even if the clEnqueueUnmapMemObject() fails?
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index dacf97899839..f430c511ceed 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -23,6 +23,7 @@
#include <sal/log.hxx>
#include <cstdio>
+#include <limits>
#include <unordered_map>
#include <vector>
@@ -118,11 +119,9 @@ void FormulaGroupContext::ensureNumArray( ColArray& rColArray, size_t nArrayLen
if (rColArray.mpNumArray)
return;
- double fNan;
- rtl::math::setNan(&fNan);
-
m_NumArrays.push_back(
- std::make_unique<sc::FormulaGroupContext::NumArrayType>(nArrayLen, fNan));
+ std::make_unique<sc::FormulaGroupContext::NumArrayType>(nArrayLen,
+ std::numeric_limits<double>::quiet_NaN()));
rColArray.mpNumArray = m_NumArrays.back().get();
}
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 288d01d2eacc..289c06b43323 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3902,9 +3902,7 @@ double applyImplicitIntersection(const sc::RangeMatrix& rMat, const ScAddress& r
return rMat.mpMat->GetDouble(nOffset, 0);
}
- double fVal;
- rtl::math::setNan(&fVal);
- return fVal;
+ return std::numeric_limits<double>::quiet_NaN();
}
// Test for Functions that evaluate an error code and directly set nGlobalError to 0
diff --git a/sc/source/filter/oox/biffhelper.cxx b/sc/source/filter/oox/biffhelper.cxx
index 11582c7e63ce..dadfd2014bea 100644
--- a/sc/source/filter/oox/biffhelper.cxx
+++ b/sc/source/filter/oox/biffhelper.cxx
@@ -23,6 +23,8 @@
#include <osl/diagnose.h>
#include <oox/helper/binaryinputstream.hxx>
+#include <limits>
+
namespace oox::xls {
namespace {
@@ -68,7 +70,7 @@ const sal_Int32 BIFF_RK_VALUEMASK = 0xFFFFFFFC;
default: OSL_FAIL( "BiffHelper::calcDoubleFromError - unknown error code" );
}
sal_math_Double aMathDouble;
- ::rtl::math::setNan( &aMathDouble.value );
+ aMathDouble.value = std::numeric_limits<double>::quiet_NaN();
aMathDouble.nan_parts.fraction_lo = nApiError;
return aMathDouble.value;
}
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 35fb72548a4c..b996449c8218 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -7,6 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <limits>
#include <memory>
#include <orcusinterface.hxx>
@@ -259,11 +260,11 @@ void ScOrcusNamedExpression::commit()
ScOrcusFactory::CellStoreToken::CellStoreToken(const ScAddress& rPos, Type eType)
: maPos(rPos)
, meType(eType)
+ , mfValue(std::numeric_limits<double>::quiet_NaN())
, mnIndex1(0)
, mnIndex2(0)
, meGrammar(formula::FormulaGrammar::GRAM_UNSPECIFIED)
{
- rtl::math::setNan(&mfValue);
}
ScOrcusFactory::CellStoreToken::CellStoreToken(const ScAddress& rPos, double fValue)
@@ -279,11 +280,11 @@ ScOrcusFactory::CellStoreToken::CellStoreToken(const ScAddress& rPos, double fVa
ScOrcusFactory::CellStoreToken::CellStoreToken(const ScAddress& rPos, uint32_t nIndex)
: maPos(rPos)
, meType(Type::String)
+ , mfValue(std::numeric_limits<double>::quiet_NaN())
, mnIndex1(nIndex)
, mnIndex2(0)
, meGrammar(formula::FormulaGrammar::GRAM_UNSPECIFIED)
{
- rtl::math::setNan(&mfValue);
}
ScOrcusFactory::CellStoreToken::CellStoreToken(const ScAddress& rPos, const OUString& rFormula,
@@ -291,11 +292,11 @@ ScOrcusFactory::CellStoreToken::CellStoreToken(const ScAddress& rPos, const OUSt
: maPos(rPos)
, meType(Type::Formula)
, maStr1(rFormula)
+ , mfValue(std::numeric_limits<double>::quiet_NaN())
, mnIndex1(0)
, mnIndex2(0)
, meGrammar(eGrammar)
{
- rtl::math::setNan(&mfValue);
}
ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc, bool bSkipDefaultStyles) :
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 638c2c5cba67..cf346c63cd15 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <limits>
#include <memory>
#include "xmlcelli.hxx"
#include "xmlimprt.hxx"
@@ -117,7 +118,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
ScXMLImportContext( rImport ),
mpEditEngine(GetScImport().GetEditEngine()),
mnCurParagraph(0),
- fValue(0.0),
+ fValue(std::numeric_limits<double>::quiet_NaN()),
nMergedRows(1),
nMatrixRows(0),
nRepeatedRows(nTempRepeatedRows),
@@ -142,8 +143,6 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
mbHasStyle(false),
mbPossibleEmptyDisplay(false)
{
- rtl::math::setNan(&fValue); // NaN by default
-
rXMLImport.GetTables().AddColumn(bTempIsCovered);
std::optional<OUString> xStyleName;
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx
index ff42d9a7d909..07d86f5a9ee5 100644
--- a/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -373,8 +373,8 @@ ScSolverValueDialog::ScSolverValueDialog(weld::Window* pParent)
: GenericDialogController(pParent, "modules/scalc/ui/doubledialog.ui", "DoubleDialog")
, m_xFrame(m_xBuilder->weld_frame("frame"))
, m_xEdValue(m_xBuilder->weld_entry("value"))
+ , m_fMaxValue(std::numeric_limits<double>::quiet_NaN())
{
- ::rtl::math::setNan(&m_fMaxValue);
}
ScSolverValueDialog::~ScSolverValueDialog()
diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
index 9d167d862e0e..2971be908072 100644
--- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx
+++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
@@ -7,6 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <limits>
#include <memory>
#include <sal/config.h>
@@ -287,9 +288,6 @@ void PivotTableDataProvider::collectPivotTableData()
return;
const uno::Sequence<uno::Sequence<sheet::DataResult>> xDataResultsSequence = xDPResults->getResults();
- double fNan;
- rtl::math::setNan(&fNan);
-
std::unordered_set<size_t> aValidRowIndex;
size_t nRowIndex = 0;
@@ -304,7 +302,8 @@ void PivotTableDataProvider::collectPivotTableData()
continue;
if (rDataResult.Flags == 0 || rDataResult.Flags & css::sheet::DataResultFlags::HASDATA)
{
- aRow.emplace_back(rDataResult.Flags ? rDataResult.Value : fNan, 0);
+ aRow.emplace_back(rDataResult.Flags ? rDataResult.Value
+ : std::numeric_limits<double>::quiet_NaN(), 0);
if (rDataResult.Flags != 0) // set as valid only if we have data
{
bRowEmpty = false;
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 3bcdf315db82..2f0461b39a5d 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -59,7 +59,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
-#include <rtl/math.hxx>
+#include <limits>
SC_SIMPLE_SERVICE_INFO( ScChart2DataProvider, "ScChart2DataProvider",
"com.sun.star.chart2.data.DataProvider")
@@ -2323,10 +2323,10 @@ void ScChart2DataSource::AddLabeledSequence(const uno::Reference < chart2::data:
// DataSequence ==============================================================
-ScChart2DataSequence::Item::Item() :
- mfValue(0.0), mbIsValue(false)
+ScChart2DataSequence::Item::Item()
+ : mfValue(std::numeric_limits<double>::quiet_NaN())
+ , mbIsValue(false)
{
- ::rtl::math::setNan(&mfValue);
}
ScChart2DataSequence::HiddenRangeListener::HiddenRangeListener(ScChart2DataSequence& rParent) :
@@ -2907,15 +2907,12 @@ uno::Sequence< double > SAL_CALL ScChart2DataSequence::getNumericalData()
BuildDataCache();
- double fNAN;
- ::rtl::math::setNan(&fNAN);
-
sal_Int32 nCount = m_aDataArray.size();
uno::Sequence<double> aSeq(nCount);
double* pArr = aSeq.getArray();
for (const Item& rItem : m_aDataArray)
{
- *pArr = rItem.mbIsValue ? rItem.mfValue : fNAN;
+ *pArr = rItem.mbIsValue ? rItem.mfValue : std::numeric_limits<double>::quiet_NaN();
++pArr;
}
diff --git a/svtools/source/table/cellvalueconversion.cxx b/svtools/source/table/cellvalueconversion.cxx
index e209fe953104..76a0a1395ffd 100644
--- a/svtools/source/table/cellvalueconversion.cxx
+++ b/svtools/source/table/cellvalueconversion.cxx
@@ -27,7 +27,6 @@
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/util/XNumberFormatTypes.hpp>
#include <com/sun/star/util/NumberFormat.hpp>
-#include <rtl/math.hxx>
#include <sal/log.hxx>
#include <tools/date.hxx>
#include <tools/time.hxx>
@@ -37,6 +36,7 @@
#include <i18nlangtag/languagetag.hxx>
#include <comphelper/processfactory.hxx>
+#include <limits>
#include <memory>
#include <unordered_map>
@@ -152,8 +152,7 @@ namespace svt
virtual double convertToDouble( Any const & i_value ) const override
{
- double returnValue(0);
- ::rtl::math::setNan( &returnValue );
+ double returnValue = std::numeric_limits<double>::quiet_NaN();
OSL_VERIFY( i_value >>= returnValue );
return returnValue;
}
@@ -210,8 +209,7 @@ namespace svt
virtual double convertToDouble( Any const & i_value ) const override
{
- double returnValue(0);
- ::rtl::math::setNan( &returnValue );
+ double returnValue = std::numeric_limits<double>::quiet_NaN();
// extract actual UNO value
DateTime aDateTimeValue;
@@ -242,8 +240,7 @@ namespace svt
virtual double convertToDouble( Any const & i_value ) const override
{
- double returnValue(0);
- ::rtl::math::setNan( &returnValue );
+ double returnValue = std::numeric_limits<double>::quiet_NaN();
// extract
css::util::Date aDateValue;
@@ -270,8 +267,7 @@ namespace svt
virtual double convertToDouble( Any const & i_value ) const override
{
- double returnValue(0);
- ::rtl::math::setNan( &returnValue );
+ double returnValue = std::numeric_limits<double>::quiet_NaN();
// extract
css::util::Time aTimeValue;
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index ee6c41b11911..611000eb9a03 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -22,6 +22,7 @@
#include <memory>
#include <vector>
#include <algorithm>
+#include <limits>
#include <cppuhelper/interfacecontainer.hxx>
#include <o3tl/any.hxx>
@@ -92,7 +93,6 @@
#include <SwStyleNameMapper.hxx>
#include <frmatr.hxx>
#include <sortopt.hxx>
-#include <rtl/math.hxx>
#include <sal/log.hxx>
#include <editeng/frmdiritem.hxx>
#include <comphelper/interfacecontainer2.hxx>
@@ -885,12 +885,9 @@ double SwXCell::getValue()
{
SolarMutexGuard aGuard;
// #i112652# a table cell may contain NaN as a value, do not filter that
- double fRet;
if(IsValid() && !getString().isEmpty())
- fRet = m_pBox->GetFrameFormat()->GetTableBoxValue().GetValue();
- else
- ::rtl::math::setNan( &fRet );
- return fRet;
+ return m_pBox->GetFrameFormat()->GetTableBoxValue().GetValue();
+ return std::numeric_limits<double>::quiet_NaN();
}
void SwXCell::setValue(double rValue)
@@ -1212,7 +1209,7 @@ double SwXCell::GetForcedNumericalValue() const
}
double fTmp;
if (!const_cast<SwDoc*>(GetDoc())->IsNumberFormat(const_cast<SwXCell*>(this)->getString(), nFIndex, fTmp))
- ::rtl::math::setNan(&fTmp);
+ return std::numeric_limits<double>::quiet_NaN();
return fTmp;
}
diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx
index cb55d2ce158a..4c818c0d4d8c 100644
--- a/vcl/source/control/fmtfield.cxx
+++ b/vcl/source/control/fmtfield.cxx
@@ -33,6 +33,7 @@
#include <vcl/weld.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <unotools/syslocale.hxx>
+#include <limits>
#include <map>
#include <rtl/math.hxx>
#include <rtl/ustrbuf.hxx>
@@ -859,14 +860,7 @@ void Formatter::SetValue(double dVal)
double Formatter::GetValue()
{
if ( !ImplGetValue( m_dCurrentValue ) )
- {
- double dValue;
- if (m_bEnableNaN)
- ::rtl::math::setNan(&dValue);
- else
- dValue = m_dDefaultValue;
- UpdateCurrentValue(dValue);
- }
+ UpdateCurrentValue(m_bEnableNaN ? std::numeric_limits<double>::quiet_NaN() : m_dDefaultValue);
m_ValueState = valueDouble;
return m_dCurrentValue;
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index f418cebd4500..4d1596b04aa5 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -46,6 +46,7 @@
#include <rtl/math.hxx>
#include <o3tl/sorted_vector.hxx>
+#include <limits>
#include <vector>
#include <algorithm>
#include <queue>
@@ -629,8 +630,6 @@ uno::Sequence< OUString > lcl_DataSequenceToStringSequence(
}
::std::vector< double > lcl_getAllValuesFromSequence( const Reference< chart2::data::XDataSequence > & xSeq )
{
- double fNan = 0.0;
- ::rtl::math::setNan( &fNan );
::std::vector< double > aResult;
if(!xSeq.is())
return aResult;
@@ -810,11 +809,9 @@ lcl_TableData lcl_getDataForLocalTable(
// resize data
aResult.aDataInRows.resize( nNumRows );
- double fNan = 0.0;
- ::rtl::math::setNan( &fNan );
for (auto& aData: aResult.aDataInRows)
- aData.resize(nNumColumns, fNan);
+ aData.resize(nNumColumns, std::numeric_limits<double>::quiet_NaN());
aResult.aColumnDescriptions.resize( nNumColumns );
aResult.aComplexColumnDescriptions.realloc( nNumColumns );
aResult.aRowDescriptions.resize( nNumRows );
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
index 6b86ad529daf..47cc4f573ed2 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -27,7 +27,6 @@
#include "transporttypes.hxx"
#include <XMLStringBufferImportContext.hxx>
#include <o3tl/safeint.hxx>
-#include <rtl/math.hxx>
#include <sal/log.hxx>
#include <xmloff/xmlnamespace.hxx>
#include <xmloff/xmltoken.hxx>
@@ -42,6 +41,7 @@
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <limits>
#include <vector>
#include <algorithm>
#include <iterator>
@@ -65,10 +65,8 @@ struct lcl_ApplyCellToData
explicit lcl_ApplyCellToData( Sequence< double > & rOutData ) :
m_rData( rOutData ),
m_nIndex( 0 ),
- m_nSize( rOutData.getLength()),
- m_fNaN( 0.0 )
+ m_nSize( rOutData.getLength())
{
- ::rtl::math::setNan( &m_fNaN );
}
void operator() ( const SchXMLCell & rCell )
@@ -78,7 +76,7 @@ struct lcl_ApplyCellToData
if( rCell.eType == SCH_CELL_TYPE_FLOAT )
m_rData[m_nIndex] = rCell.fValue;
else
- m_rData[m_nIndex] = m_fNaN;
+ m_rData[m_nIndex] = std::numeric_limits<double>::quiet_NaN();
}
++m_nIndex;
}
@@ -92,7 +90,6 @@ private:
Sequence< double > & m_rData;
sal_Int32 m_nIndex;
sal_Int32 m_nSize;
- double m_fNaN;
};
void lcl_fillRangeMapping(
@@ -741,10 +738,8 @@ void SchXMLTableHelper::applyTableToInternalDataProvider(
// values
Sequence< double >& rTargetRow = aDataInRows[nRow];
lcl_ApplyCellToData aApplyCellToData = ::std::for_each( rRow.begin() + nColOffset, rRow.end(), lcl_ApplyCellToData( rTargetRow ) );
- double fNaN = 0.0;
- ::rtl::math::setNan( &fNaN );
for( sal_Int32 nCurrentIndex = aApplyCellToData.getCurrentIndex(); nCurrentIndex<nNumColumns; nCurrentIndex++ )
- rTargetRow[nCurrentIndex] = fNaN;//#i110615#
+ rTargetRow[nCurrentIndex] = std::numeric_limits<double>::quiet_NaN();//#i110615#
}
}
}
More information about the Libreoffice-commits
mailing list