[Libreoffice-commits] core.git: sc/qa sc/source

Eike Rathke erack at redhat.com
Mon Mar 10 12:56:25 PDT 2014


 sc/qa/unit/data/xlsx/functions-excel-2010.xlsx |binary
 sc/source/core/tool/interpr2.cxx               |   32 ++++---------------------
 2 files changed, 6 insertions(+), 26 deletions(-)

New commits:
commit 0abe86ca86b91e83815b0d95e1d08bf7fbc697d2
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Mar 10 20:49:38 2014 +0100

    round to multiple of absolute significance, fdo#71720 follow-up
    
    The new functions FLOOR.PRECISE, CEILING.PRECISE and ISO.CEILING always
    round to a multiple of the absolute value of the significance given,
    returning the mathematical floor/ceiling in all cases.
    
    Also changed the test doc to use some meaningful values for these
    functions.
    
    Change-Id: Id5a26092838765143e2d308afa49e7119107dac5

diff --git a/sc/qa/unit/data/xlsx/functions-excel-2010.xlsx b/sc/qa/unit/data/xlsx/functions-excel-2010.xlsx
old mode 100755
new mode 100644
index 48f5a7f..208c1c5
Binary files a/sc/qa/unit/data/xlsx/functions-excel-2010.xlsx and b/sc/qa/unit/data/xlsx/functions-excel-2010.xlsx differ
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 885f00c..0c38865 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -638,27 +638,17 @@ void ScInterpreter::ScCeil_MS()
         if ( nParamCount == 1 )
         {
             fVal = GetDouble();
-            fDec = ( fVal < 0 ? -1 : 1 );
+            fDec = 1.0;
         }
         else
         {
-            bool bArgumentMissing = IsMissing();
-            fDec = GetDouble();
+            fDec = fabs( GetDoubleWithDefault( 1.0 ));
             fVal = GetDouble();
-            if ( bArgumentMissing )
-                fDec = ( fVal < 0 ? -1 : 1 );
         }
         if ( fDec == 0.0 || fVal == 0.0 )
             PushInt( 0 );
         else
-        {
-            if ( fVal * fDec > 0.0 )
-                fDec *= -1.0;
-            if ( fVal < 0.0 )
-                PushDouble(::rtl::math::approxFloor( fVal / fDec ) * fDec );
-            else
-                PushDouble(::rtl::math::approxCeil( fVal / fDec ) * fDec );
-        }
+            PushDouble(::rtl::math::approxCeil( fVal / fDec ) * fDec );
     }
 }
 
@@ -693,27 +683,17 @@ void ScInterpreter::ScFloor_MS()
         if ( nParamCount == 1 )
         {
             fVal = GetDouble();
-            fDec = ( fVal < 0 ? -1 : 1 );
+            fDec = 1.0;
         }
         else
         {
-            bool bArgumentMissing = IsMissing();
-            fDec = GetDouble();
+            fDec = fabs( GetDoubleWithDefault( 1.0 ));
             fVal = GetDouble();
-            if ( bArgumentMissing )
-                fDec = ( fVal < 0 ? -1 : 1 );
         }
         if ( fDec == 0.0 || fVal == 0.0 )
             PushInt( 0 );
         else
-        {
-            if ( fVal * fDec > 0.0 )
-                fDec *= -1.0;
-            if ( fVal < 0.0 )
-                PushDouble(::rtl::math::approxCeil( fVal / fDec ) * fDec );
-            else
-                PushDouble(::rtl::math::approxFloor( fVal / fDec ) * fDec );
-        }
+            PushDouble(::rtl::math::approxFloor( fVal / fDec ) * fDec );
     }
 }
 


More information about the Libreoffice-commits mailing list