[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sc/source
Winfried Donkers
winfrieddonkers at libreoffice.org
Tue Jan 24 00:27:29 UTC 2017
sc/source/core/tool/interpr3.cxx | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
New commits:
commit 6db82982d65b2b15aa7cc2aab5e6219f2db15dd7
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date: Sun Jan 15 15:14:15 2017 +0100
tdf#105348 add check for divide by zero situation.
Reviewed-on: https://gerrit.libreoffice.org/33098
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Eike Rathke <erack at redhat.com>
(cherry picked from commit 84e87423c182ec78aba4eb108355906a0d2f0096)
Backported, without test case document.
Change-Id: I339997870a7983d829a8909d2b3da7b3ab03f58d
Reviewed-on: https://gerrit.libreoffice.org/33484
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index c9e145d..77767f8 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2695,8 +2695,14 @@ void ScInterpreter::ScTTest()
PushNoValue();
return;
}
- fT = sqrt(fCount-1.0) * fabs(fSum1 - fSum2) /
- sqrt(fCount * fSumSqrD - (fSum1-fSum2)*(fSum1-fSum2));
+ double fSumD = fSum1 - fSum2;
+ double fDivider = (fCount*fSumSqrD - fSumD*fSumD);
+ if ( fDivider == 0.0 )
+ {
+ PushError(FormulaError::DivisionByZero);
+ return;
+ }
+ fT = fabs(fSumD) * sqrt((fCount-1.0) / fDivider);
fF = fCount - 1.0;
}
else if (fTyp == 2.0)
More information about the Libreoffice-commits
mailing list