[Libreoffice-commits] core.git: chart2/source
Laurent Balland-Poirier
laurent.balland-poirier at laposte.net
Tue Oct 6 23:41:20 PDT 2015
chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx | 12 +++--------
1 file changed, 4 insertions(+), 8 deletions(-)
New commits:
commit ce9d48e5f58ec26e817202414a08225db1c11206
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date: Sun Oct 4 22:47:13 2015 +0200
Log trend line equation: Remove useless variable
Change-Id: I70e960742b4af2c1ab234b6d1c681254c0627b03
Reviewed-on: https://gerrit.libreoffice.org/19138
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
Tested-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
index d43d437..3370454 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( " - " );
More information about the Libreoffice-commits
mailing list