[Libreoffice-commits] core.git: scaddins/source
Winfried Donkers
winfrieddonkers at libreoffice.org
Mon Jul 11 14:55:25 UTC 2016
scaddins/source/analysis/analysis.cxx | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
New commits:
commit 09f6bfadad0be9ebe24abcde1876a0b2d0c9fd97
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date: Mon Jul 11 10:04:12 2016 +0200
tdf#100843 LCM_EXCEL2003 fix incorrect handling of non-integer values.
Non-integer values should be truncated as Excel does.
Also, make the function return an error with negative values.
Change-Id: I6a8ce1fb82d20294d9398ca2af308f88b51d5e82
Reviewed-on: https://gerrit.libreoffice.org/27096
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx
index 0cd5d79..a8d9be1 100644
--- a/scaddins/source/analysis/analysis.cxx
+++ b/scaddins/source/analysis/analysis.cxx
@@ -738,18 +738,22 @@ double SAL_CALL AnalysisAddIn::getLcm( const uno::Reference< beans::XPropertySet
if( aValList.Count() == 0 )
return 0.0;
- double f = aValList.Get(0);
+ double f = rtl::math::approxFloor( aValList.Get(0) );
+ if( f < 0.0 )
+ throw lang::IllegalArgumentException();
if( f == 0.0 )
return f;
for( sal_uInt32 i = 1; i < aValList.Count(); ++i )
{
- double fTmp = aValList.Get(i);
+ double fTmp = rtl::math::approxFloor( aValList.Get(i) );
+ if( fTmp < 0.0 )
+ throw lang::IllegalArgumentException();
+
+ f = fTmp * f / GetGcd( fTmp, f );
if( f == 0.0 )
return f;
- else
- f = fTmp * f / GetGcd( fTmp, f );
}
RETURN_FINITE( f );
More information about the Libreoffice-commits
mailing list