[Libreoffice-commits] core.git: sc/source
Eike Rathke
erack at redhat.com
Wed Oct 12 18:46:39 UTC 2016
sc/source/filter/excel/excform.cxx | 4 ++--
sc/source/filter/excel/impop.cxx | 2 +-
sc/source/filter/excel/xelink.cxx | 2 +-
sc/source/filter/excel/xichart.cxx | 2 +-
sc/source/filter/xml/xmlcelli.cxx | 6 +++---
5 files changed, 8 insertions(+), 8 deletions(-)
New commits:
commit c31fe18cb50724557a9b8272329addf5f818ef47
Author: Eike Rathke <erack at redhat.com>
Date: Wed Oct 12 20:41:42 2016 +0200
use isFinite() instead of !isNan()
... to cover (theoretical?) +/-inf values as well.
Change-Id: I23ab17f905bbd32345b88bea87ad6f010a5406ad
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index d911f18..67e7657 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -131,7 +131,7 @@ void ImportExcel::Formula(
rDoc.getDoc().EnsureTable(aScPos.Tab());
rDoc.setFormulaCell(aScPos, pCell);
pCell->SetNeedNumberFormat(false);
- if (!rtl::math::isNan(fCurVal))
+ if (rtl::math::isFinite(fCurVal))
pCell->SetResultDouble(fCurVal);
GetXFRangeBuffer().SetXF(aScPos, nXF);
@@ -173,7 +173,7 @@ void ImportExcel::Formula(
if( eErr != ConvOK )
ExcelToSc::SetError( *pCell, eErr );
- if (!rtl::math::isNan(fCurVal))
+ if (rtl::math::isFinite(fCurVal))
pCell->SetResultDouble(fCurVal);
}
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index ad28654..01b5b73 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -869,7 +869,7 @@ void ImportExcel::Shrfmla()
rDoc.getDoc().EnsureTable(aPos.Tab());
rDoc.setFormulaCell(aPos, pCell);
pCell->SetNeedNumberFormat(false);
- if (!rtl::math::isNan(mpLastFormula->mfValue))
+ if (rtl::math::isFinite(mpLastFormula->mfValue))
pCell->SetResultDouble(mpLastFormula->mfValue);
GetXFRangeBuffer().SetXF(aPos, mpLastFormula->mnXF);
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index b850510..2bfe779 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -1182,7 +1182,7 @@ void XclExpCrn::WriteBool( XclExpStream& rStrm, bool bValue )
void XclExpCrn::WriteDouble( XclExpStream& rStrm, double fValue )
{
- if( ::rtl::math::isNan( fValue ) )
+ if( !::rtl::math::isFinite( fValue ) )
{
FormulaError nScError = GetDoubleErrorValue(fValue);
WriteError( rStrm, XclTools::GetXclErrorCode( nScError ) );
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 8739a44d..ac12021 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -1639,7 +1639,7 @@ Reference< XRegressionCurve > XclImpChSerTrendLine::CreateRegressionCurve() cons
aPropSet.SetProperty(EXC_CHPROP_EXTRAPOLATE_FORWARD, maData.mfForecastFor);
aPropSet.SetProperty(EXC_CHPROP_EXTRAPOLATE_BACKWARD, maData.mfForecastBack);
- bool bForceIntercept = !rtl::math::isNan(maData.mfIntercept);
+ bool bForceIntercept = rtl::math::isFinite(maData.mfIntercept);
aPropSet.SetProperty(EXC_CHPROP_FORCE_INTERCEPT, bForceIntercept);
if (bForceIntercept)
{
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 1369dbc..4633eb7 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1034,7 +1034,7 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
pFCell->ResetDirty();
}
}
- else if (!rtl::math::isNan(fValue))
+ else if (rtl::math::isFinite(fValue))
{
pFCell->SetHybridDouble(fValue);
pFCell->ResetDirty();
@@ -1165,7 +1165,7 @@ void ScXMLTableRowCellContext::PutValueCell( const ScAddress& rCurrentPos )
// fdo#62250 absent values are not NaN, set to 0.0
// PutValueCell() is called only for a known cell value type,
// bIsEmpty==false in all these cases, no sense to check it here.
- if (::rtl::math::isNan( fValue))
+ if (!::rtl::math::isFinite( fValue))
fValue = 0.0;
// #i62435# Initialize the value cell's script type if the default
@@ -1451,7 +1451,7 @@ void ScXMLTableRowCellContext::AddFormulaCell( const ScAddress& rCellPos )
pFCell->ResetDirty();
}
}
- else if (!rtl::math::isNan(fValue))
+ else if (rtl::math::isFinite(fValue))
{
pFCell->SetResultMatrix(
nMatrixCols, nMatrixRows, pMat, new formula::FormulaDoubleToken(fValue));
More information about the Libreoffice-commits
mailing list