summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorLaurent Balland-Poirier <laurent.balland-poirier@laposte.net>2015-10-04 22:47:13 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-10-07 06:40:53 +0000
commitce9d48e5f58ec26e817202414a08225db1c11206 (patch)
tree99317c01ad9bcd7b5f96031e979058971aa3eadf /chart2
parent867fcf48d51b3b30a5cb046a4955ef078f5e6d79 (diff)
Log trend line equation: Remove useless variable
Change-Id: I70e960742b4af2c1ab234b6d1c681254c0627b03 Reviewed-on: https://gerrit.libreoffice.org/19138 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx12
1 files changed, 4 insertions, 8 deletions
diff --git a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
index d43d437e3a59..3370454bcbe6 100644
--- a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
@@ -52,7 +52,7 @@ void SAL_CALL LogarithmicRegressionCurveCalculator::recalculateRegression(
RegressionCalculationHelper::isValidAndXPositive()));
const size_t nMax = aValues.first.size();
- if( nMax == 0 )
+ if( nMax <= 1 ) // at least 2 points
{
::rtl::math::setNan( & m_fSlope );
::rtl::math::setNan( & m_fIntercept );
@@ -134,14 +134,14 @@ OUString LogarithmicRegressionCurveCalculator::ImplGetRepresentation(
{
OUStringBuffer aBuf( "f(x) = ");
- bool bHaveSlope = false;
-
if( m_fSlope != 0.0 )
{
if( ::rtl::math::approxEqual( fabs( m_fSlope ), 1.0 ))
{
- if( m_fSlope < 0 )
+ if( m_fSlope < 0.0 )
+ {
aBuf.append( "-" );
+ }
}
else
{
@@ -149,11 +149,7 @@ OUString LogarithmicRegressionCurveCalculator::ImplGetRepresentation(
aBuf.append( " " );
}
aBuf.append( "ln(x)" );
- bHaveSlope = true;
- }
- if( bHaveSlope )
- {
if( m_fIntercept < 0.0 )
{
aBuf.append( " - " );