Kaydet (Commit) 0f79a5ff authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Eike Rathke

tdf#84435: Mod operator does not deal with decimals as described in help

Change-Id: I8dbfdf4bb2eceac0b5afbddd3f35e1dcde2db68b
Reviewed-on: https://gerrit.libreoffice.org/14611Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: 's avatarEike Rathke <erack@redhat.com>
üst 3d69f625
......@@ -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;
......
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