[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - basic/source

Julien Nabet serval2412 at yahoo.fr
Thu Apr 30 07:33:12 PDT 2015


 basic/source/comp/exprnode.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit b51a30504ec3c00b0bad616817471aa01918e06e
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Tue Feb 24 23:02:24 2015 +0100

    tdf#84435: Mod operator does not deal with decimals as described in help
    
    Change-Id: I8dbfdf4bb2eceac0b5afbddd3f35e1dcde2db68b
    Reviewed-on: https://gerrit.libreoffice.org/14611
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 0f79a5ff07e5b392044726b657998561cbe97fda)
    Reviewed-on: https://gerrit.libreoffice.org/15576

diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index 4340848..140074e 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -320,9 +320,9 @@ void SbiExprNode::FoldConstants()
                     else if( nl < SbxMINLNG ) err = true, nl = SbxMINLNG;
                     if( nr > SbxMAXLNG ) err = true, nr = SbxMAXLNG;
                     else if( nr < SbxMINLNG ) err = true, nr = SbxMINLNG;
-                    ll = (long) nl; lr = (long) nr;
-                    llMod = (long) (nl < 0 ? nl - 0.5 : nl + 0.5);
-                    lrMod = (long) (nr < 0 ? nr - 0.5 : nr + 0.5);
+                    ll = static_cast<long>(nl); lr = static_cast<long>(nr);
+                    llMod = static_cast<long>(nl);
+                    lrMod = static_cast<long>(nr);
                     if( err )
                     {
                         pGen->GetParser()->Error( SbERR_MATH_OVERFLOW );
@@ -387,7 +387,7 @@ void SbiExprNode::FoldConstants()
                         {
                             pGen->GetParser()->Error( SbERR_ZERODIV ); nVal = HUGE_VAL;
                             bError = true;
-                        } else nVal = llMod % lrMod;
+                        } else nVal = llMod - lrMod * (llMod/lrMod);
                         eType = SbxLONG; break;
                     case AND:
                         nVal = (double) ( ll & lr ); eType = SbxLONG; break;


More information about the Libreoffice-commits mailing list