Commit 7151383b authored by Alexander Semke's avatar Alexander Semke
Browse files

[coverity] CID: 211328, 211326, 21330.

parent d0b0eaa4
......@@ -835,7 +835,10 @@ void Column::calculateStatistics() const {
const double centralMoment_r4 = sumForCentralMoment_r4 / notNanCount;
statistics.variance = columnSumVariance / notNanCount;
statistics.standardDeviation = sqrt(statistics.variance * notNanCount / (notNanCount - 1));
if (notNanCount != 1)
statistics.standardDeviation = sqrt(statistics.variance * notNanCount / (notNanCount - 1));
else
statistics.standardDeviation = NAN;
statistics.skewness = centralMoment_r3 / gsl_pow_3(statistics.standardDeviation);
statistics.kurtosis = (centralMoment_r4 / gsl_pow_4(statistics.standardDeviation)) - 3.0;
statistics.meanDeviation = columnSumMeanDeviation / notNanCount;
......
......@@ -264,6 +264,8 @@ void XYSmoothCurvePrivate::recalculate() {
roughVector->data()[i] = ydataOriginal[i] - ydata[i];
roughColumn->setChanged();
delete [] ydataOriginal;
//redraw the curve
recalcLogicalPoints();
emit q->dataChanged();
......
......@@ -1020,7 +1020,7 @@ void SpreadsheetTest::testSortPerformanceNumeric1() {
#if QT_VERSION >= 0x051000
xData << QRandomGenerator::global()->generateDouble();
#else
xData << qrand()/RAND_MAX;
xData << (double)(qrand())/RAND_MAX;
#endif
auto* col = sheet.column(0);
......@@ -1046,7 +1046,7 @@ void SpreadsheetTest::testSortPerformanceNumeric2() {
#if QT_VERSION >= 0x051000
xData << QRandomGenerator::global()->generateDouble();
#else
xData << qrand()/RAND_MAX;
xData << (double)(qrand())/RAND_MAX;
#endif
yData << i + 1;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment