summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-03-10 20:49:38 +0100
committerEike Rathke <erack@redhat.com>2014-03-10 20:56:02 +0100
commit0abe86ca86b91e83815b0d95e1d08bf7fbc697d2 (patch)
tree1aa2729e7b92a49038f30ca627a1ece6dd5f1b7f
parent00933638350c99082bffe58771ab1f914c59078a (diff)
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
-rw-r--r--[-rwxr-xr-x]sc/qa/unit/data/xlsx/functions-excel-2010.xlsxbin15440 -> 15459 bytes
-rw-r--r--sc/source/core/tool/interpr2.cxx32
2 files changed, 6 insertions, 26 deletions
diff --git a/sc/qa/unit/data/xlsx/functions-excel-2010.xlsx b/sc/qa/unit/data/xlsx/functions-excel-2010.xlsx
index 48f5a7f5a515..208c1c55e078 100755..100644
--- a/sc/qa/unit/data/xlsx/functions-excel-2010.xlsx
+++ b/sc/qa/unit/data/xlsx/functions-excel-2010.xlsx
Binary files differ
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 885f00c70a66..0c3886581666 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 );
}
}