Kaydet (Commit) 09f6bfad authored tarafından Winfried Donkers's avatar Winfried Donkers Kaydeden (comit) Eike Rathke

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/27096Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: 's avatarEike Rathke <erack@redhat.com>
üst 3d76efda
......@@ -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 );
......
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