diff options
-rw-r--r-- | scaddins/source/analysis/analysis.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index 0cd5d7982d8b..a8d9be1cb194 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 ); |