summaryrefslogtreecommitdiff
path: root/basic/source/runtime/methods1.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/runtime/methods1.cxx')
-rw-r--r--basic/source/runtime/methods1.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index f54ff7baea4f..8802245b6498 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -2531,6 +2531,26 @@ RTLFUNC(FormatDateTime)
rPar.Get(0)->PutString( aRetStr );
}
+RTLFUNC(Frac)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ sal_uInt16 nParCount = rPar.Count();
+ if( nParCount != 2)
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ SbxVariable *pSbxVariable = rPar.Get(1);
+ double dVal = pSbxVariable->GetDouble();
+ if(dVal >= 0)
+ rPar.Get(0)->PutDouble(dVal - ::rtl::math::approxFloor(dVal));
+ else
+ rPar.Get(0)->PutDouble(dVal - ::rtl::math::approxCeil(dVal));
+}
+
RTLFUNC(Round)
{
(void)pBasic;