sc/source/core/opencl/formulagroupcl.cxx          |    2 
 sc/source/core/opencl/op_financial.cxx            |   69 ++++------
 sc/source/core/opencl/op_math.cxx                 |   18 +-
 sc/source/core/opencl/op_statistical.cxx          |  147 ++++++++++------------
 sc/source/core/opencl/opinlinefun_finacial.cxx    |   44 +++---
 sc/source/core/opencl/opinlinefun_statistical.cxx |  113 ++++++++--------
 6 files changed, 191 insertions(+), 202 deletions(-)

New commits:
commit 7d3ff55a0d072c825dac843bfbf6659a460103ba
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Aug 30 15:43:39 2022 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Wed Aug 31 09:14:59 2022 +0200

    pow(x,-1) -> 1/x in opencl code
    
    Ok, division is somewhat slow, but pow() is hardly going to be faster.
    
    Change-Id: I1c0d94243a67d0cd77874eb6b9ee6b4ef9206240
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139049
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 5800ef08c89d..eb2ea2fcc98b 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1513,7 +1513,7 @@ public:
                 "    return 0;\n";
         ss << "return tmp";
         if (isAverage())
-            ss << "*pow((double)nCount,-1.0)";
+            ss << "/(double)nCount";
         ss << ";\n}";
     }
     virtual bool isAverage() const { return false; }
diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index 30a47cbfbd93..342bd67b2657 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -82,7 +82,7 @@ void RRI::GenSlidingWindowFunction(
     ss<<"        fv = ";
     ss << vSubArguments[2]->GenSlidingWindowDeclRef();
     ss<<";\n";
-    ss << "    tmp = pow(fv*pow(pv,-1),1.0*pow(nper,-1))-1;\n";
+    ss << "    tmp = pow(fv/pv,1.0/nper)-1;\n";
     ss << "    return tmp;\n";
     ss << "}";
 }
@@ -138,7 +138,7 @@ vSubArguments)
     }
     ss<<"if(tmp1==0)\n\t";
     ss<<"\treturn 0;\n\t";
-    ss<<"tmp=pow( tmp1,-1);\n\t";
+    ss<<"tmp= 1.0 / tmp1;\n\t";
     ss<<"tmp=( pow( tmp0+ 1.0, tmp ) - 1.0 ) *";
     ss<<"tmp1;\n\t";
     ss << "return tmp;\n";
@@ -558,7 +558,7 @@ void OpISPMT::GenSlidingWindowFunction(std::stringstream& 
ss,
             ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n";
         }
     }
-    ss << "    tmp = arg3 * arg0 * ( arg1 - arg2) * pow(arg2, -1);\n";
+    ss << "    tmp = arg3 * arg0 * ( arg1 - arg2) / arg2;\n";
     ss << "    return tmp;\n";
     ss << "}";
 }
@@ -611,7 +611,7 @@ void 
OpPDuration::GenSlidingWindowFunction(std::stringstream& ss,
             ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n";
         }
     }
-    ss << "    tmp = log(arg2 * pow( arg1,-1)) / log(arg0 + 1.0);\n";
+    ss << "    tmp = log(arg2 / arg1) / log(arg0 + 1.0);\n";
     ss << "    return tmp;\n";
     ss << "}";
 }
@@ -1366,9 +1366,8 @@ void OpSYD::GenSlidingWindowFunction(std::stringstream 
&ss,
     ss <<"        period = ";
     ss << vSubArguments[3]->GenSlidingWindowDeclRef();
     ss <<";\n";
-    ss <<"    double tmpvalue = ((life*(life+1))*pow(2.0,-1));\n";
-    ss <<"    result = ((cost-salvage)*(life-period+1)";
-    ss << "*pow(tmpvalue,-1));\n";
+    ss <<"    double tmpvalue = ((life*(life+1))/2.0);\n";
+    ss <<"    result = ((cost-salvage)*(life-period+1)/tmpvalue);\n";
     ss <<"    return result;\n";
     ss <<"}\n";
 }
@@ -1494,7 +1493,7 @@ void 
OpEffective::GenSlidingWindowFunction(std::stringstream& ss,
             ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n";
         }
     }
-    ss << "    tmp = pow(1.0 + arg0 * pow(arg1, -1), arg1)-1.0;\n";
+    ss << "    tmp = pow(1.0 + arg0 / arg1, arg1)-1.0;\n";
     ss << "    return tmp;\n";
     ss << "}";
 }
@@ -2153,7 +2152,7 @@ void OpSLN::GenSlidingWindowFunction(std::stringstream 
&ss,
     ss<<"        life = ";
     ss << vSubArguments[2]->GenSlidingWindowDeclRef();
     ss<<";\n";
-    ss << "    tmp = (cost-salvage)*pow(life,-1);\n";
+    ss << "    tmp = (cost-salvage)/life;\n";
     ss << "    return tmp;\n";
     ss << "}";
 }
@@ -2349,8 +2348,8 @@ void OpPMT::GenSlidingWindowFunction(std::stringstream 
&ss,
     ss<<"        return -(tmp2+tmp3)/tmp1;\n";
     ss<<"    tmp-=tmp3;\n";
     ss<<"    tmp=tmp-tmp2*pow(1.0+tmp0,tmp1);\n";
-    ss<<"    tmp=tmp*pow(( (1.0+tmp0*tmp4)* ";
-    ss<<"( (pow(1.0+tmp0,tmp1)-1.0)/tmp0)),-1);\n";
+    ss<<"    tmp=tmp/( (1.0+tmp0*tmp4)* ";
+    ss<<"( (pow(1.0+tmp0,tmp1)-1.0)/tmp0));\n";
     ss<<"    return tmp;\n";
     ss<<"}";
 }
@@ -2874,10 +2873,10 @@ void OpNper::GenSlidingWindowFunction(std::stringstream 
&ss,
     ss <<"    if (tmp0 == 0.0)\n";
     ss <<"        tmp=(-1*(tmp2 + tmp3)/tmp1);\n";
     ss <<"    else if (tmp4 > 0.0)\n";
-    ss <<"        tmp=log(-1*(tmp0*tmp3-tmp1*(1.0+tmp0))*";
-    ss <<"pow((tmp0*tmp2+tmp1*(1.0+tmp0)),-1))/log(1.0+tmp0);\n";
+    ss <<"        tmp=log(-1*(tmp0*tmp3-tmp1*(1.0+tmp0))";
+    ss <<"/(tmp0*tmp2+tmp1*(1.0+tmp0)))/log(1.0+tmp0);\n";
     ss <<"    else\n";
-    ss <<"        tmp=log(-1*(tmp0*tmp3-tmp1)*pow(tmp0*tmp2+tmp1,-1))";
+    ss <<"        tmp=log(-1*(tmp0*tmp3-tmp1)/(tmp0*tmp2+tmp1))";
     ss <<"/log(1.0+tmp0);\n";
     ss <<"    return tmp;\n";
     ss <<"}";
@@ -2948,8 +2947,8 @@ void OpPPMT::GenSlidingWindowFunction(std::stringstream 
&ss,
     ss<<"    if(tmp0==0.0)\n";
     ss<<"        return -(tmp3+tmp4)/tmp2;\n";
     ss<<"    pmt=pmt-tmp4-tmp3*pow(1.0+tmp0,tmp2);\n";
-    ss<<"    pmt=pmt*pow(( (1.0+tmp0*tmp5)* ";
-    ss<<"( (pow(1.0+tmp0,tmp2)-1.0)/tmp0)),-1);\n";
+    ss<<"    pmt=pmt/( (1.0+tmp0*tmp5)* ";
+    ss<<"( (pow(1.0+tmp0,tmp2)-1.0)/tmp0));\n";
     ss<<"    double temp = pow( 1+tmp0,tmp1-2);\n";
     ss<<"    double re;\n";
     ss<<"    if(tmp1==1.0){\n";
@@ -3631,7 +3630,7 @@ void 
OpAmordegrc::GenSlidingWindowFunction(std::stringstream &ss,
         ss << ";\n";
     }
     ss <<"    uint nPer = convert_int( fPer );\n";
-    ss <<"    double fUsePer = 1.0 *pow( fRate,-1);\n";
+    ss <<"    double fUsePer = 1.0 / fRate;\n";
     ss <<"    double fAmorCoeff;\n";
     ss <<"    if( fUsePer < 3.0 )\n";
     ss <<"        fAmorCoeff = 1.0;\n";
@@ -3791,7 +3790,7 @@ void 
OpAmorlinc::GenSlidingWindowFunction(std::stringstream &ss,
     ss <<"    double f0Rate = GetYearFrac( 693594,";
     ss <<"nDate, nFirstPer, nBase )* fRate * fCost;\n";
     ss <<"    int nNumOfFullPeriods = (int)";
-    ss <<"( ( fCost - fRestVal - f0Rate) *pow(fOneRate,-1) );\n";
+    ss <<"( ( fCost - fRestVal - f0Rate) / fOneRate );\n";
     ss <<"    if( nPer == 0 )\n";
     ss <<"        tmp = f0Rate;\n";
     ss <<"    else if( nPer <= nNumOfFullPeriods )\n";
@@ -3897,7 +3896,7 @@ void 
OpReceived::GenSlidingWindowFunction(std::stringstream &ss,
     ss << "    double tmpvalue = (1.0-(fDisc";
     ss <<" * GetYearDiff( GetNullDate()";
     ss <<",nSettle,nMat,rOB)));\n";
-    ss << "    tmp = fInvest*pow(tmpvalue,-1);\n";
+    ss << "    tmp = fInvest/tmpvalue;\n";
     ss << "    return tmp;\n";
     ss << "}";
 }
@@ -4127,14 +4126,13 @@ void RATE::GenSlidingWindowFunction(
     ss << "            if (fX == 0.0)\n";
     ss << "            {\n";
     ss << "                fGeoSeries = arg0;\n";
-    ss << "                fGeoSeriesDerivation = arg0 * (arg0-1.0)";
-    ss << "*pow(2.0,-1);\n";
+    ss << "                fGeoSeriesDerivation = arg0 * (arg0-1.0) / 2.0;\n";
     ss << "            }\n";
     ss << "            else\n";
     ss << "            {";
-    ss << "                fGeoSeries = (fPowN-1.0)*pow(fX,-1);\n";
+    ss << "                fGeoSeries = (fPowN-1.0)/fX;\n";
     ss << "                fGeoSeriesDerivation =";
-    ss << " arg0 * fPowNminus1 * pow( fX , -1) - fGeoSeries * pow(fX, -1);\n";
+    ss << " arg0 * fPowNminus1 / fX - fGeoSeries / fX;\n";
     ss << "            }\n";
     ss << "            fTerm = arg3 + arg2 *fPowN+ arg1 * fGeoSeries;\n";
     ss << "            fTermDerivation = arg2 * arg0 * fPowNminus1 +";
@@ -4146,8 +4144,7 @@ void RATE::GenSlidingWindowFunction(
     ss << "                if (fTermDerivation == 0.0)\n";
     ss << "                    fXnew = fX + 1.1 * SCdEpsilon;\n";
     ss << "                else\n";
-    ss << "                    fXnew = fX - fTerm ";
-    ss << "*pow( fTermDerivation,-1);\n";
+    ss << "                    fXnew = fX - fTerm / fTermDerivation;\n";
     ss << "                nCount++;\n";
     ss << "                bFound = (fabs(fXnew - fX) < SCdEpsilon);\n";
     ss << "                fX = fXnew;\n";
@@ -4162,13 +4159,12 @@ void RATE::GenSlidingWindowFunction(
     ss << "            if (fX == 0.0){\n";
     ss << "                fGeoSeries = arg0;\n";
     ss << "                fGeoSeriesDerivation = arg0 * ";
-    ss << "(arg0-1.0)* pow(2.0,-1);\n";
+    ss << "(arg0-1.0) / 2.0;\n";
     ss << "            }else{\n";
-    ss << "                fGeoSeries = (pow( 1.0+fX, arg0) - 1.0)";
-    ss << " *pow( fX,-1);\n";
+    ss << "                fGeoSeries = (pow( 1.0+fX, arg0) - 1.0) / fX;\n";
     ss << "                fGeoSeriesDerivation =";
-    ss << " arg0 * pow(1.0+fX,arg0-1.0) *pow(fX,-1)";
-    ss << " - fGeoSeries *pow( fX,-1);\n";
+    ss << " arg0 * pow(1.0+fX,arg0-1.0) / fX";
+    ss << " - fGeoSeries / fX;\n";
     ss << "            }\n";
     ss << "            fTerm = arg3 + arg2 *pow(1.0+fX, arg0)";
     ss << "+ arg1 * fGeoSeries;\n";
@@ -4181,8 +4177,7 @@ void RATE::GenSlidingWindowFunction(
     ss << "                if (fTermDerivation == 0.0)\n";
     ss << "                    fXnew = fX + 1.1 * SCdEpsilon;\n";
     ss << "                else\n";
-    ss << "                    fXnew = fX - fTerm ";
-    ss << "*pow( fTermDerivation,-1);\n";
+    ss << "                    fXnew = fX - fTerm / fTermDerivation;\n";
     ss << "                nCount++;\n";
     ss << "                bFound = (fabs(fXnew - fX) < SCdEpsilon);\n";
     ss << "                fX = fXnew;\n";
@@ -4280,9 +4275,9 @@ void OpTbillyield::GenSlidingWindowFunction(
     ss <<"    int nDiff=GetDiffDate360(GetNullDate(),tmp000,tmp001,true);\n";
     ss <<"    nDiff++;\n";
     ss <<"    tmp=100.0;\n";
-    ss <<"    tmp = tmp *pow( tmp002,-1);\n";
+    ss <<"    tmp = tmp / tmp002;\n";
     ss <<"    tmp = tmp - 1.0;\n";
-    ss <<"    tmp = tmp * pow( nDiff,-1.0 );\n";
+    ss <<"    tmp = tmp / nDiff;\n";
     ss <<"    tmp = tmp * 360.0;\n";
     ss <<"    return tmp;\n";
     ss << "}\n";
@@ -4366,7 +4361,7 @@ void OpDDB::GenSlidingWindowFunction(std::stringstream& 
ss,
     }
     ss <<"        fFactor = "<<vSubArguments[4]->GenSlidingWindowDeclRef();
     ss <<";\n";
-    ss <<"    fRate = fFactor * pow(fLife,-1);\n";
+    ss <<"    fRate = fFactor / fLife;\n";
     ss <<"    if (fRate >= 1.0)\n";
     ss <<"    {\n";
     ss <<"        fRate = 1.0;\n";
@@ -4507,10 +4502,10 @@ tmpCur4);
     ss << "        result=fv+pmt*nper;\n";
     ss << "    else if(type > 0)\n";
     ss << "        result=(fv*pow(1+rate,-nper))+";
-    ss << "(pmt*(1-pow(1+rate,-nper+1))*pow(rate,-1))+pmt;\n";
+    ss << "(pmt*(1-pow(1+rate,-nper+1))/rate)+pmt;\n";
     ss << "    else\n";
     ss << "        result=(fv*pow(1+rate,-nper))+";
-    ss << "(pmt*(1-pow(1+rate,-nper))*pow(rate,-1));\n";
+    ss << "(pmt*(1-pow(1+rate,-nper))/rate);\n";
     ss << "    return -result;\n";
     ss << "}";
 }
diff --git a/sc/source/core/opencl/op_math.cxx 
b/sc/source/core/opencl/op_math.cxx
index 5914436ffd8e..817da13dc732 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -87,7 +87,7 @@ void OpSec::GenSlidingWindowFunction(std::stringstream &ss,
     ss<<tmpCurDVR->GetArrayLength();
     ss<<"))\n";
     ss<<"        arg0 = 0;\n";
-    ss << "    return pow(cos(arg0),-1 );\n";
+    ss << "    return 1.0 / cos(arg0);\n";
     ss << "}";
 }
 void OpCosh::BinInlineFun(std::set<std::string>& decls,
@@ -118,7 +118,7 @@ void OpSecH::GenSlidingWindowFunction(std::stringstream &ss,
     ss<<tmpCurDVR->GetArrayLength();
     ss<<"))\n";
     ss<<"        arg0 = 0;\n";
-    ss << "    return pow(cosh(arg0),-1 );\n";
+    ss << "    return 1.0 / cosh(arg0);\n";
     ss << "}";
 }
 void OpMROUND::GenSlidingWindowFunction(std::stringstream &ss,
@@ -174,7 +174,7 @@ void OpMROUND::GenSlidingWindowFunction(std::stringstream 
&ss,
     }
     ss<<"    if(arg1==0)\n";
     ss<<"        return arg1;\n";
-    ss<<"    tmp=arg1 * round(arg0 * pow(arg1,-1));\n";
+    ss<<"    tmp=arg1 * round(arg0 / arg1);\n";
     ss<<"    return tmp;\n";
     ss<<"}";
 }
@@ -252,7 +252,7 @@ void OpCot::GenSlidingWindowFunction(std::stringstream &ss,
         ss << ";\n";
     }
     ss << "    arg0 = arg0 * M_1_PI;\n";
-    ss << "    return cospi(arg0) * pow(sinpi(arg0), -1);\n";
+    ss << "    return cospi(arg0) / sinpi(arg0);\n";
     ss << "}";
 }
 
@@ -1141,7 +1141,7 @@ void OpTan::GenSlidingWindowFunction(std::stringstream 
&ss,
         ss << ";\n";
     }
     ss << "    arg0 = arg0 * M_1_PI;\n";
-    ss << "    return sinpi(arg0) * pow(cospi(arg0), -1);\n";
+    ss << "    return sinpi(arg0) / cospi(arg0);\n";
     ss << "}";
 }
 void OpTanH::GenSlidingWindowFunction(std::stringstream &ss,
@@ -1364,7 +1364,7 @@ void 
OpArcCotHyp::GenSlidingWindowFunction(std::stringstream &ss,
         ss << vSubArguments[0]->GenSlidingWindowDeclRef();
         ss << ";\n";
     }
-    ss << "    return 0.5 * log(1 + 2 * pown(arg0 - 1.0, -1));\n";
+    ss << "    return 0.5 * log(1 + 2 / (arg0 - 1.0));\n";
     ss << "}";
 }
 void OpArcSin::BinInlineFun(std::set<std::string>& decls,
@@ -1779,7 +1779,7 @@ void 
OpRadians::GenSlidingWindowFunction(std::stringstream &ss,
     ss << "    double tmp;\n";
     GenTmpVariables(ss,vSubArguments);
     CheckAllSubArgumentIsNan(ss,vSubArguments);
-    ss << "    tmp = tmp0 * 3.14159265358979 * pow(180.0,-1);\n";
+    ss << "    tmp = tmp0 * 3.14159265358979 / 180.0;\n";
     ss << "    return tmp;\n";
     ss << "}";
 }
@@ -2628,7 +2628,7 @@ void OpCombin::GenSlidingWindowFunction(std::stringstream 
&ss,
     ss << "            num_chosen-1.0,\n";
     ss << "            num_chosen-2.0,\n";
     ss << "            num_chosen-3.0};\n";
-    ss << "        db4result = db4num * pown(db4num_chosen, -1);\n";
+    ss << "        db4result = db4num / db4num_chosen;\n";
     ss << "        db2result = db4result.xy * db4result.zw;\n";
     ss << "        result *=  db2result.x * db2result.y;\n";
     ss << "        num = num - 4.0;\n";
@@ -2930,7 +2930,7 @@ void OpDeg::GenSlidingWindowFunction(std::stringstream 
&ss,
         ss << vSubArguments[0]->GenSlidingWindowDeclRef();
         ss << ";\n";
     }
-    ss << "    return arg0 * pown(M_PI, -1) * 180;;\n";
+    ss << "    return arg0 / M_PI * 180;;\n";
     ss << "}";
 }
 
diff --git a/sc/source/core/opencl/op_statistical.cxx 
b/sc/source/core/opencl/op_statistical.cxx
index ff7ed1e95bca..2f9af33c1f22 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -110,7 +110,7 @@ void OpVar::GenSlidingWindowFunction(std::stringstream &ss,
         }
         if (i == 0)
         {
-            ss << "    fMean = fSum * pow(fCount,-1.0);\n";
+            ss << "    fMean = fSum / fCount;\n";
         }
     }
     i = vSubArguments.size();
@@ -190,7 +190,7 @@ void OpVar::GenSlidingWindowFunction(std::stringstream &ss,
     ss << "    if (fCount <= 1.0)\n";
     ss << "        return CreateDoubleError(DivisionByZero);\n";
     ss << "    else\n";
-    ss << "        return vSum * pow(fCount - 1.0,-1.0);\n";
+    ss << "        return vSum / (fCount - 1.0);\n";
     ss << "}\n";
 }
 void OpZTest::BinInlineFun(std::set<std::string>& decls,
@@ -275,9 +275,8 @@ void OpZTest::GenSlidingWindowFunction(std::stringstream 
&ss,
             ss << "    }\n";
             ss << "    if(fCount <= 1.0)\n";
             ss << "        return DBL_MAX;\n";
-            ss << "    mue = fSum *pow(fCount,-1.0);\n";
-            ss << "    sigma = (fSumSqr-fSum*fSum*";
-            ss << "pow(fCount,-1.0))*pow(fCount-1.0,-1.0);\n";
+            ss << "    mue = fSum / fCount;\n";
+            ss << "    sigma = (fSumSqr-fSum*fSum/fCount)/(fCount-1.0);\n";
         }
         else
         {
@@ -367,7 +366,7 @@ void OpZTest::GenSlidingWindowFunction(std::stringstream 
&ss,
             ss << "    }\n";
             ss << "    if(fCount <= 1.0)\n";
             ss << "        return DBL_MAX;\n";
-            ss << "    mue = fSum * pow(fCount,-1.0);\n";
+            ss << "    mue = fSum / fCount;\n";
         }
         else
         {
@@ -882,7 +881,7 @@ void OpVarP::GenSlidingWindowFunction(std::stringstream &ss,
         }
         if (i == 0)
         {
-            ss << "    fMean = fSum * pow(fCount,-1.0);\n";
+            ss << "    fMean = fSum / fCount;\n";
         }
     }
     i = vSubArguments.size();
@@ -960,7 +959,7 @@ void OpVarP::GenSlidingWindowFunction(std::stringstream &ss,
     ss << "    if (fCount == 0.0)\n";
     ss << "        return DBL_MAX;\n";
     ss << "    else\n";
-    ss << "        return vSum * pow(fCount,-1.0);\n";
+    ss << "        return vSum / fCount;\n";
     ss << "}\n";
 }
 
@@ -1389,7 +1388,7 @@ void 
OpStandard::GenSlidingWindowFunction(std::stringstream &ss,
     ss << "    if(sigma <= 0.0)\n";
     ss << "        return DBL_MAX;\n";
     ss << "    else\n";
-    ss << "        return (x - mu)*pow(sigma,-1.0);\n";
+    ss << "        return (x - mu)/sigma;\n";
     ss << "}";
 }
 
@@ -1653,7 +1652,7 @@ void OpSkew::GenSlidingWindowFunction(std::stringstream 
&ss,
             ss << "    if(fCount <= 2.0)\n";
             ss << "        return DBL_MAX;\n";
             ss << "    else\n";
-            ss << "        fMean = fSum * pow(fCount,-1.0);\n";
+            ss << "        fMean = fSum / fCount;\n";
         }
     }
     i = vSubArguments.size();
@@ -1727,7 +1726,7 @@ void OpSkew::GenSlidingWindowFunction(std::stringstream 
&ss,
             ss << "    vSum += (arg - fMean) * (arg - fMean);\n";
         }
     }
-    ss << "    double fStdDev = sqrt(vSum * pow(fCount - 1.0,-1.0));\n";
+    ss << "    double fStdDev = sqrt(vSum / (fCount - 1.0));\n";
     ss << "    double dx = 0.0;\n";
     ss << "    double xcube = 0.0;\n";
     ss << "    if(fStdDev == 0.0)\n";
@@ -1773,7 +1772,7 @@ void OpSkew::GenSlidingWindowFunction(std::stringstream 
&ss,
                 ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n";
                 ss << "        if (isnan(arg))\n";
                 ss << "            continue;\n";
-                ss << "        dx = (arg - fMean) * pow(fStdDev,-1.0);\n";
+                ss << "        dx = (arg - fMean) / fStdDev;\n";
                 ss << "        xcube = xcube + dx * dx * dx;\n";
                 ss << "    }\n";
             }
@@ -1787,7 +1786,7 @@ void OpSkew::GenSlidingWindowFunction(std::stringstream 
&ss,
                 ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n";
                 ss << "        if (!isnan(arg))\n";
                 ss << "        {\n";
-                ss << "            dx = (arg - fMean) * pow(fStdDev,-1.0);\n";
+                ss << "            dx = (arg - fMean) / fStdDev;\n";
                 ss << "            xcube = xcube + dx * dx * dx;\n";
                 ss << "        }\n";
                 ss << "    }\n";
@@ -1795,7 +1794,7 @@ void OpSkew::GenSlidingWindowFunction(std::stringstream 
&ss,
             else
             {
                 ss << "    arg = " << pCur->GetDouble() << ";\n";
-                ss << "    dx = (arg - fMean) * pow(fStdDev,-1.0);\n";
+                ss << "    dx = (arg - fMean) / fStdDev;\n";
                 ss << "    xcube = xcube + dx * dx * dx;\n";
             }
         }
@@ -1803,12 +1802,12 @@ void OpSkew::GenSlidingWindowFunction(std::stringstream 
&ss,
         {
             ss << "    arg = ";
             ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n";
-            ss << "    dx = (arg - fMean) * pow(fStdDev,-1.0);\n";
+            ss << "    dx = (arg - fMean) / fStdDev;\n";
             ss << "    xcube = xcube + dx * dx * dx;\n";
         }
     }
-    ss << "    return ((xcube * fCount) * pow(fCount - 1.0,-1.0))";
-    ss << " * pow(fCount - 2.0,-1.0);\n";
+    ss << "    return ((xcube * fCount) / (fCount - 1.0))";
+    ss << " / (fCount - 2.0);\n";
     ss << "}\n";
 }
 
@@ -1910,7 +1909,7 @@ void OpSkewp::GenSlidingWindowFunction(std::stringstream 
&ss,
             ss << "    if(fCount <= 2.0)\n";
             ss << "        return DBL_MAX;\n";
             ss << "    else\n";
-            ss << "        fMean = fSum * pow(fCount,-1.0);\n";
+            ss << "        fMean = fSum / fCount;\n";
         }
     }
     i = vSubArguments.size();
@@ -1984,7 +1983,7 @@ void OpSkewp::GenSlidingWindowFunction(std::stringstream 
&ss,
             ss << "    vSum += (arg - fMean) * (arg - fMean);\n";
         }
     }
-    ss << "    double fStdDev = sqrt(vSum * pow(fCount,-1.0));\n";
+    ss << "    double fStdDev = sqrt(vSum / fCount);\n";
     ss << "    double dx = 0.0;\n";
     ss << "    double xcube = 0.0;\n";
     ss << "    if(fStdDev == 0.0)\n";
@@ -2030,7 +2029,7 @@ void OpSkewp::GenSlidingWindowFunction(std::stringstream 
&ss,
                 ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n";
                 ss << "        if (isnan(arg))\n";
                 ss << "            continue;\n";
-                ss << "        dx = (arg - fMean) * pow(fStdDev,-1.0);\n";
+                ss << "        dx = (arg - fMean) / fStdDev;\n";
                 ss << "        xcube = xcube + dx * dx * dx;\n";
                 ss << "    }\n";
             }
@@ -2044,7 +2043,7 @@ void OpSkewp::GenSlidingWindowFunction(std::stringstream 
&ss,
                 ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n";
                 ss << "        if (!isnan(arg))\n";
                 ss << "        {\n";
-                ss << "            dx = (arg - fMean) * pow(fStdDev,-1.0);\n";
+                ss << "            dx = (arg - fMean) / fStdDev;\n";
                 ss << "            xcube = xcube + dx * dx * dx;\n";
                 ss << "        }\n";
                 ss << "    }\n";
@@ -2052,7 +2051,7 @@ void OpSkewp::GenSlidingWindowFunction(std::stringstream 
&ss,
             else
             {
                 ss << "    arg = " << pCur->GetDouble() << ";\n";
-                ss << "    dx = (arg - fMean) * pow(fStdDev,-1.0);\n";
+                ss << "    dx = (arg - fMean) / fStdDev;\n";
                 ss << "    xcube = xcube + dx * dx * dx;\n";
             }
         }
@@ -2060,11 +2059,11 @@ void 
OpSkewp::GenSlidingWindowFunction(std::stringstream &ss,
         {
             ss << "    arg = ";
             ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n";
-            ss << "    dx = (arg - fMean) * pow(fStdDev,-1.0);\n";
+            ss << "    dx = (arg - fMean) / fStdDev;\n";
             ss << "    xcube = xcube + dx * dx * dx;\n";
         }
     }
-    ss << "    return xcube * pow(fCount,-1.0);\n";
+    ss << "    return xcube / fCount;\n";
     ss << "}\n";
 }
 
@@ -2289,7 +2288,7 @@ void OpStDev::GenSlidingWindowFunction(std::stringstream 
&ss,
         }
         if (i == 0)
         {
-            ss << "    fMean = fSum * pow(fCount,-1.0);\n";
+            ss << "    fMean = fSum / fCount;\n";
         }
     }
     i = vSubArguments.size();
@@ -2365,7 +2364,7 @@ void OpStDev::GenSlidingWindowFunction(std::stringstream 
&ss,
     ss << "    if (fCount <= 1.0)\n";
     ss << "        return DBL_MAX;\n";
     ss << "    else\n";
-    ss << "        return sqrt(vSum * pow(fCount - 1.0,-1.0));\n";
+    ss << "        return sqrt(vSum / (fCount - 1.0));\n";
     ss << "}\n";
 }
 
@@ -2464,7 +2463,7 @@ void OpStDevP::GenSlidingWindowFunction(std::stringstream 
&ss,
         }
         if (i == 0)
         {
-            ss << "    fMean = fSum * pow(fCount,-1.0);\n";
+            ss << "    fMean = fSum / fCount;\n";
         }
     }
     i = vSubArguments.size();
@@ -2541,7 +2540,7 @@ void OpStDevP::GenSlidingWindowFunction(std::stringstream 
&ss,
     ss << "    if (fCount == 0.0)\n";
     ss << "        return DBL_MAX;\n";
     ss << "    else\n";
-    ss << "        return sqrt(vSum * pow(fCount,-1.0));\n";
+    ss << "        return sqrt(vSum / fCount);\n";
     ss << "}\n";
 }
 
@@ -2635,8 +2634,8 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream 
&ss,
         ss << "        return CreateDoubleError(NoValue);\n";
         ss << "    else\n";
         ss << "    {\n";
-        ss << "        fMeanX = fSumX * pow(fCount,-1.0);\n";
-        ss << "        fMeanY = fSumY * pow(fCount,-1.0);\n";
+        ss << "        fMeanX = fSumX / fCount;\n";
+        ss << "        fMeanY = fSumY / fCount;\n";
 
         ss << "        for (int i = ";
         if ((!pDVR->IsStartFixed() && pDVR->IsEndFixed())
@@ -2679,7 +2678,7 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream 
&ss,
         ss << "            return CreateDoubleError(DivisionByZero);\n";
         ss << "        else\n";
         ss << "        {\n";
-        ss << "            return fSumDeltaXDeltaY*pow(fSumSqrDeltaX,-1.0);\n";
+        ss << "            return fSumDeltaXDeltaY / fSumSqrDeltaX;\n";
         ss << "        }\n";
         ss << "    }\n";
         ss << "}\n";
@@ -2788,8 +2787,8 @@ void OpSTEYX::GenSlidingWindowFunction(std::stringstream 
&ss,
         ss << "        return DBL_MAX;\n";
         ss << "    else\n";
         ss << "    {\n";
-        ss << "        fMeanX = fSumX * pow(fCount,-1.0);\n";
-        ss << "        fMeanY = fSumY * pow(fCount,-1.0);\n";
+        ss << "        fMeanX = fSumX / fCount;\n";
+        ss << "        fMeanY = fSumY / fCount;\n";
 
         ss << "        for (int i = ";
         if ((!pDVR->IsStartFixed() && pDVR->IsEndFixed())
@@ -2834,8 +2833,8 @@ void OpSTEYX::GenSlidingWindowFunction(std::stringstream 
&ss,
         ss << "        else\n";
         ss << "        {\n";
         ss << "            return sqrt((fSumSqrDeltaY - fSumDeltaXDeltaY * \n";
-        ss << "                   fSumDeltaXDeltaY*pow(fSumSqrDeltaX,-1.0))\n";
-        ss << "                   *pow(fCount - 2.0,-1.0));\n";
+        ss << "                   fSumDeltaXDeltaY / fSumSqrDeltaX)\n";
+        ss << "                   /(fCount - 2.0));\n";
         ss << "        }\n";
         ss << "    }\n";
         ss << "}\n";
@@ -2893,7 +2892,7 @@ vSubArguments)
     }
     ss << "    if (fabs(arg0) >= 1.0)\n";
     ss << "        return DBL_MAX;\n";
-    ss << "    double tmp=0.5*log((1+arg0)*pow((1-arg0),-1));\n";
+    ss << "    double tmp=0.5*log((1+arg0)/(1-arg0));\n";
     ss << "    return tmp;\n";
     ss << "}\n";
 }
@@ -3607,7 +3606,7 @@ vSubArguments)
             ss << ";\n";
             ss << "    if(!isnan(tmp))\n";
             ss << "    {\n";
-            ss << "        nVal += (1.0 * pow( tmp,-1));\n";
+            ss << "        nVal += (1.0 / tmp);\n";
             ss << "        totallength +=1;\n";
             ss << "    }\n";
         }
@@ -3616,7 +3615,7 @@ vSubArguments)
            ss << "    tmp = ";
            ss << vSubArguments[i]->GenSlidingWindowDeclRef();
            ss << ";\n";
-           ss << "    nVal += (1.0 *pow( tmp,-1));\n";
+           ss << "    nVal += (1.0 / tmp);\n";
            ss << "    totallength +=1;\n";
         }
         else
@@ -3624,7 +3623,7 @@ vSubArguments)
             ss << "    return DBL_MIN;\n";
         }
     }
-    ss << "    tmp = totallength*pow(nVal,-1);\n";
+    ss << "    tmp = totallength/nVal;\n";
     ss << "    return tmp;\n";
     ss << "}";
 }
@@ -3695,8 +3694,7 @@ void 
OpConfidence::GenSlidingWindowFunction(std::stringstream& ss,
     ss << "|| rn < 1.0)\n";
     ss << "        tmp = -DBL_MAX;\n";
     ss << "    else\n";
-    ss << "        tmp = gaussinv(1.0 - alpha * pow(2.0,-1.0)) * sigma ";
-    ss << "* pow(sqrt( rn ),-1);\n";
+    ss << "        tmp = gaussinv(1.0 - alpha / 2.0) * sigma / sqrt( rn );\n";
     ss << "    return tmp;\n";
     ss << "}";
 }
@@ -3781,8 +3779,7 @@ void 
OpCritBinom::GenSlidingWindowFunction(std::stringstream& ss,
     ss << "                uint max =(uint)(rn), i;\n";
     ss << "                for (i = 0; i < max && fSum >= alpha; i++)\n";
     ss << "                {\n";
-    ss << " fFactor *= (rn - i) * pow((double)(i + 1),-1.0) *";
-    ss << " rq * pow(p, -1.0);\n";
+    ss << " fFactor *= (rn - i) / (double)(i + 1) * rq / p;\n";
     ss << "                    fSum -= fFactor;\n";
     ss << "                }\n";
     ss << "                tmp = (rn - i);\n";
@@ -3794,8 +3791,8 @@ void 
OpCritBinom::GenSlidingWindowFunction(std::stringstream& ss,
     ss << "            uint max = (uint)(rn), i;\n";
     ss << "            for (i = 0; i < max && fSum < alpha; i++)\n";
     ss << "            {\n";
-    ss << " fFactor *= (rn - i) * pow((double)(i + 1), -1.0) *";
-    ss << " p * pow(rq, -1.0);\n";
+    ss << " fFactor *= (rn - i) / (double)(i + 1) *";
+    ss << " p / rq;\n";
     ss << "                fSum += fFactor;\n";
     ss << "            }\n";
     ss << "            tmp = (i);\n";
@@ -4840,7 +4837,7 @@ void OpKurt:: GenSlidingWindowFunction(std::stringstream 
&ss,
             ss << "    return DBL_MIN;\n";
         }
     }
-    ss << "    double fMean = fSum * pow(totallength,-1);\n";
+    ss << "    double fMean = fSum / totallength;\n";
     for (size_t i = 0; i < vSubArguments.size(); i++)
     {
         FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
@@ -5046,8 +5043,8 @@ void 
OpIntercept::GenSlidingWindowFunction(std::stringstream &ss,
         ss << "        return NAN;\n";
         ss << "    else\n";
         ss << "    {\n";
-        ss << "        fMeanX = fSumX * pow(fCount,-1.0);\n";
-        ss << "        fMeanY = fSumY * pow(fCount,-1.0);\n";
+        ss << "        fMeanX = fSumX / fCount;\n";
+        ss << "        fMeanY = fSumY / fCount;\n";
 
         ss << "        for (int i = ";
         if ((!pDVR->IsStartFixed() && pDVR->IsEndFixed())
@@ -5091,7 +5088,7 @@ void 
OpIntercept::GenSlidingWindowFunction(std::stringstream &ss,
         ss << "        else\n";
         ss << "        {\n";
         ss << "            return fMeanY -";
-        ss << " (fSumDeltaXDeltaY*pow(fSumSqrDeltaX,-1.0))*fMeanX;\n";
+        ss << " (fSumDeltaXDeltaY/fSumSqrDeltaX)*fMeanX;\n";
         ss << "        }\n";
         ss << "    }\n";
         ss << "}\n";
@@ -5888,8 +5885,7 @@ void OpBinomdist::GenSlidingWindowFunction(
     ss << "                        for (uint i = 0; i < max && fFactor > 0.0;";
     ss << " i++)\n";
     ss << "                        {\n";
-    ss << "                           fFactor *= (tmp1 - i)*pow((i + 
1),-1.0)*";
-    ss << "rq*pow(tmp2,-1.0);\n";
+    ss << "                           fFactor *= (tmp1 - i)/(i + 
1)*rq/tmp2;\n";
     ss << "                            fSum -= fFactor;\n";
     ss << "                        }\n";
     ss << "                         return ( (fSum < 0.0) ? 0.0 : fSum );\n";
@@ -6241,10 +6237,9 @@ void 
OpGammaInv::GenSlidingWindowFunction(std::stringstream &ss,
     "            {\n"
     "                if (fPy!=fQy && fQy!=fRy && fRy!=fPy)\n"
     "                {\n"
-    "                    fSx = fPx * fRy * fQy *pow( (fRy-fPy),-1) *pow"
-    "( (fQy-fPy),-1)"
-    "+ fRx * fQy * fPy *pow( (fQy-fRy),-1) *pow( (fPy-fRy),-1)"
-    "+ fQx * fPy * fRy *pow( (fPy-fQy),-1) *pow( (fRy-fQy),-1);\n"
+    "                    fSx = fPx * fRy * fQy / (fRy-fPy) / (fQy-fPy)"
+    "+ fRx * fQy * fPy / (fQy-fRy) / (fPy-fRy)"
+    "+ fQx * fPy * fRy / (fPy-fQy) / (fRy-fQy);\n"
     "                    bHasToInterpolate = (fAx < fSx) && (fSx < fBx);\n"
     "                }\n"
     "                else\n"
@@ -6427,10 +6422,10 @@ void OpFInv::GenSlidingWindowFunction(std::stringstream 
&ss,
     "        {\n"
     "            if (fPy!=fQy && fQy!=fRy && fRy!=fPy)\n"
     "            {\n"
-    "                fSx = fPx * fRy * fQy *pow( (fRy-fPy),-1)"
-    " *pow( (fQy-fPy),-1)+fRx * fQy * fPy*pow( (fQy-fRy),-1) *"
-    "pow( (fPy-fRy),-1)+ fQx * fPy * fRy *pow( (fPy-fQy),-1)"
-    " *pow((fRy-fQy),-1);\n"
+    "                fSx = fPx * fRy * fQy / (fRy-fPy)"
+    " / (fQy-fPy)+fRx * fQy * fPy / (fQy-fRy)"
+    " / (fPy-fRy)+ fQx * fPy * fRy / (fPy-fQy)"
+    " / (fRy-fQy);\n"
     "                bHasToInterpolate = (fAx < fSx) && (fSx < fBx);\n"
     "            }\n"
     "            else\n"
@@ -6799,7 +6794,7 @@ void OpPoisson::GenSlidingWindowFunction(
     ss << "            {\n";
     ss << "                double fPoissonVar = 1.0;\n";
     ss << "                for ( int f = 0; f < x; ++f )\n";
-    ss << "          fPoissonVar *= lambda * pow(( (double)f + 1.0 ),-1);\n";
+    ss << "          fPoissonVar *= lambda / ( (double)f + 1.0 );\n";
     ss << "                tmp = ( fPoissonVar * exp( -lambda ) );\n";
     ss << "                return tmp;\n";
     ss << "            }\n";
@@ -6831,7 +6826,7 @@ void OpPoisson::GenSlidingWindowFunction(
     ss << "                     int nEnd = (int) (x + 0.5);\n";
     ss << "                     for (int i = 1; i <= nEnd; i++)\n";
     ss << "                     {\n";
-    ss << "                fSummand = (fSummand*lambda)*pow((double)i,-1);\n";
+    ss << "                fSummand = (fSummand*lambda)/((double)i);\n";
     ss << "                         fSum += fSummand;\n";
     ss << "                     }\n";
     ss << "                     tmp = fSum;\n";
@@ -7213,7 +7208,7 @@ void 
OpBetaDist::GenSlidingWindowFunction(std::stringstream &ss,
     "            tmp = 1.0;\n"
     "            return tmp;\n"
     "        }\n"
-    "        arg0 = (arg0-arg3)*pow(fScale,-1);\n"
+    "        arg0 = (arg0-arg3)/fScale;\n"
     "        tmp =  GetBetaDist(arg0, arg1, arg2);\n"
     "    }\n"
     "    else\n"
@@ -7223,8 +7218,8 @@ void 
OpBetaDist::GenSlidingWindowFunction(std::stringstream &ss,
     "            tmp = 0.0;\n"
     "            return tmp;\n"
     "        }\n"
-    "        arg0 = (arg0 - arg3)*pow(fScale,-1);\n"
-    "        tmp = GetBetaDistPDF(arg0, arg1, arg2)*pow(fScale,-1);\n"
+    "        arg0 = (arg0 - arg3)/fScale;\n"
+    "        tmp = GetBetaDistPDF(arg0, arg1, arg2)/fScale;\n"
     "    }\n";
     ss << "    return tmp;\n";
     ss << "}\n";
@@ -7637,7 +7632,7 @@ void 
OpHypGeomDist::GenSlidingWindowFunction(std::stringstream &ss,
     "        }\n"
     "        else\n"
     "            num[i]=0.5*log(2.0*PI)+(num[i]+0.5)*log(num[i])-num[i]+"
-    "(1.0*pow(12.0*num[i],-1)-1.0*pow(360*pow(num[i],3),-1));\n"
+    "(1.0/(12.0*num[i])-1.0/(360*pow(num[i],3)));\n"
     "    }\n";
     ss << "    tmp=pow(M_E,(num[0]+num[3]+num[7]+num[8]";
     ss << "-num[1]-num[2]-num[4]-num[5]-num[6]));\n";
@@ -8235,7 +8230,7 @@ vSubArguments)
                 ss << "    }\n";
         }
     }
-    ss << "    return tmp0*pow(nCount,-1);\n";
+    ss << "    return tmp0/nCount;\n";
     ss << "}\n";
 }
 void OpVarA::GenSlidingWindowFunction(std::stringstream &ss,
@@ -8432,7 +8427,7 @@ void OpVarA::GenSlidingWindowFunction(std::stringstream 
&ss,
         }
         if (i == 0)
         {
-            ss << "    fMean = fSum * pow(fCount,-1.0);\n";
+            ss << "    fMean = fSum / fCount;\n";
         }
     }
     i = vSubArguments.size();
@@ -8604,7 +8599,7 @@ void OpVarA::GenSlidingWindowFunction(std::stringstream 
&ss,
     ss << "    if (fCount <= 1.0)\n";
     ss << "        return DBL_MAX;\n";
     ss << "    else\n";
-    ss << "        return vSum * pow(fCount - 1.0,-1.0);\n";
+    ss << "        return vSum / (fCount - 1.0);\n";
     ss << "}\n";
 }
 
@@ -8800,7 +8795,7 @@ void OpVarPA::GenSlidingWindowFunction(std::stringstream 
&ss,
         }
         if (i == 0)
         {
-            ss << "    fMean = fSum * pow(fCount,-1.0);\n";
+            ss << "    fMean = fSum / fCount;\n";
         }
     }
     i = vSubArguments.size();
@@ -8972,7 +8967,7 @@ void OpVarPA::GenSlidingWindowFunction(std::stringstream 
&ss,
     ss << "    if (fCount == 0.0)\n";
     ss << "        return DBL_MAX;\n";
     ss << "    else\n";
-    ss << "        return vSum * pow(fCount,-1.0);\n";
+    ss << "        return vSum / fCount;\n";
     ss << "}\n";
 }
 void OpStDevA::GenSlidingWindowFunction(std::stringstream &ss,
@@ -9167,7 +9162,7 @@ void OpStDevA::GenSlidingWindowFunction(std::stringstream 
&ss,
         }
         if (i == 0)
         {
-            ss << "    fMean = fSum * pow(fCount,-1.0);\n";
+            ss << "    fMean = fSum / fCount;\n";
         }
     }
     i = vSubArguments.size();
@@ -9339,7 +9334,7 @@ void OpStDevA::GenSlidingWindowFunction(std::stringstream 
&ss,
     ss << "    if (fCount <= 1.0)\n";
     ss << "        return DBL_MAX;\n";
     ss << "    else\n";
-    ss << "        return sqrt(vSum * pow(fCount - 1.0,-1.0));\n";
+    ss << "        return sqrt(vSum / (fCount - 1.0));\n";
     ss << "}\n";
 }
 
@@ -9535,7 +9530,7 @@ void 
OpStDevPA::GenSlidingWindowFunction(std::stringstream &ss,
         }
         if (i == 0)
         {
-            ss << "    fMean = fSum * pow(fCount,-1.0);\n";
+            ss << "    fMean = fSum / fCount;\n";
         }
     }
     i = vSubArguments.size();
@@ -9707,7 +9702,7 @@ void 
OpStDevPA::GenSlidingWindowFunction(std::stringstream &ss,
     ss << "    if (fCount == 1.0)\n";
     ss << "        return DBL_MAX;\n";
     ss << "    else\n";
-    ss << "        return sqrt(vSum * pow(fCount,-1.0));\n";
+    ss << "        return sqrt(vSum / fCount);\n";
     ss << "}\n";
 }
 
@@ -9777,7 +9772,7 @@ void OpAveDev:: 
GenSlidingWindowFunction(std::stringstream &ss,
            ss << "    totallength +=1;\n";
         }
     }
-    ss << "    double mean = sum * pow(totallength,-1);\n";
+    ss << "    double mean = sum / totallength;\n";
     ss << "    sum = 0.0;\n";
     for (size_t i = 0; i < vSubArguments.size(); i++)
     {
@@ -9821,7 +9816,7 @@ void OpAveDev:: 
GenSlidingWindowFunction(std::stringstream &ss,
            ss << "    sum += fabs(tmp-mean);\n";
         }
     }
-    ss << "    tmp=sum*pow(totallength,-1);\n";
+    ss << "    tmp=sum/totallength;\n";
     ss << "    return tmp;\n";
     ss << "}";
 }
diff --git a/sc/source/core/opencl/opinlinefun_finacial.cxx 
b/sc/source/core/opencl/opinlinefun_finacial.cxx
index bc036f274821..dd12767cf93a 100644
--- a/sc/source/core/opencl/opinlinefun_finacial.cxx
+++ b/sc/source/core/opencl/opinlinefun_finacial.cxx
@@ -50,11 +50,11 @@ std::string GetPMT_new=
 "    double fPmt;\n"
 "        double  fTerm = pow( 1.0 + fRate, fNper );\n"
 "        if( nPayType > 0 )\n"
-"            fPmt = ( fFv * fRate *pow ( fTerm - 1.0,-1 ) + fPv * fRate *pow( "
-"( 1.0 - pow( fTerm,-1) ),-1) )* pow ( 1.0 + fRate,-1 );\n"
+"            fPmt = ( fFv * fRate / ( fTerm - 1.0 ) + fPv * fRate /"
+"( 1.0 - 1.0 / fTerm ) ) / ( 1.0 + fRate );\n"
 "        else\n"
-"            fPmt = fFv * fRate *pow ( fTerm - 1.0 ,-1) + fPv * fRate *pow( "
-"1.0 - pow( fTerm,-1),-1 );\n"
+"            fPmt = fFv * fRate / ( fTerm - 1.0 ) + fPv * fRate / ( "
+"1.0 - 1.0 / fTerm);\n"
 "    return -fPmt;\n"
 "}\n";
 std::string GetFVDecl =
@@ -92,9 +92,9 @@ std::string GetFV_new =
 "    double  fTerm = pow( 1.0 + fRate, fNper );\n"
 "    if( nPayType > 0 )\n"
 "        fFv = fPv * fTerm + fPmt * ( 1.0 + fRate ) *( fTerm - 1.0 ) "
-"*pow( fRate,-1);\n"
+"/ fRate;\n"
 "    else\n"
-"        fFv = fPv * fTerm + fPmt * ( fTerm - 1.0 ) *pow( fRate,-1);\n"
+"        fFv = fPv * fTerm + fPmt * ( fTerm - 1.0 ) / fRate;\n"
 "    return -fFv;\n"
 "}\n";
 
@@ -230,8 +230,8 @@ std::string DateToDays_new=
 "int  DateToDays_new( int nDay, int nMonth, int nYear )\n"
 "{\n"
 "    int nDays = (nYear-1) * 365;\n"
-"    nDays += (int)((nYear-1) *pow(4.0,-1.0)- (nYear-1) *pow( 100.0,-1.0)"
-"+ (nYear-1) *pow(400.0,-1.0));\n"
+"    nDays += (int)((nYear-1) / 4.0 - (nYear-1) / 100.0"
+"+ (nYear-1) / 400.0);\n"
 "    for( int i = 1; i < nMonth; i++ )\n"
 "        nDays += DaysInMonth(i,nYear);\n"
 "    nDays += nDay;\n"
@@ -670,14 +670,14 @@ std::string lcl_Getcoupdays_new=
 "    while(checklessthan(sYear,rYear,sMonth,rMonth,snDay,rnDay,sbLastDay,"
 "rbLastDay,sDay,rDay))\n"
 "    {\n"
-"        double d = -1*12*pow((double)nFreq,-1.0);\n"
+"        double d = -1*12/(double)nFreq;\n"
 "        addMonths(rb30Days,rbLastDay,&rnDay,rDay,&rMonth,d,&rYear);\n"
 "        aDate=DateToDays_new( rnDay,rMonth,rYear );\n"
 "    }\n"
 "    int aNextDate=aDate;int aDay=rDay,aMonth=rMonth, aYear=rYear;\n"
 "    int abLastDayMode=rbLastDayMode, abLastDay=rbLastDay,ab30Days=rb30Days,"
 "abUSMode=rbUSMode,anDay=rnDay;\n"
-"    int tmp = (int)(12*pow((double)nFreq,-1.0));\n"
+"    int tmp = (int)(12/(double)nFreq);\n"
 "    addMonths(ab30Days,abLastDay,&anDay,aDay,&aMonth,tmp,&aYear);\n"
 "    return getDiff( aDate, aNextDate, rDay, rMonth, rYear, rbLastDayMode, "
 "rbLastDay, rb30Days, rbUSMode, rnDay, aDay, aMonth, aYear, abLastDayMode,"
@@ -807,7 +807,7 @@ std::string coupdays_new=
 "    if( nBase == 1 )\n"
 "        return lcl_Getcoupdays_new(nNullDate, nSettle, nMat,nFreq, nBase);\n"
 "    else\n"
-"        return (double)GetDaysInYear(0,0,nBase)*pow((double)nFreq,-1.0);\n"
+"        return (double)GetDaysInYear(0,0,nBase)/(double)nFreq;\n"
 "}\n";
 
 std::string coupdaybsDecl=
@@ -1199,9 +1199,9 @@ std::string GetYieldmat=
 "    double      fIssSet = GetYearFrac_new( nNullDate, nIssue, nSettle, nBase 
);\n"
 "    double      fSetMat = GetYearFrac_new( nNullDate, nSettle, nMat, nBase 
);\n"
 "    double      y = 1.0 + fIssMat * fRate;\n"
-"    y =y * pow( (fPrice / 100.0 + fIssSet * fRate),-1);\n"
+"    y =y / (fPrice / 100.0 + fIssSet * fRate);\n"
 "    y-=1.0;\n"
-"    y = y * pow(fSetMat,-1);\n"
+"    y = y / fSetMat;\n"
 "    return y;\n"
 "}\n";
 
@@ -1278,7 +1278,7 @@ std::string GetYearDiff=
 "    int   nTotalDays = GetDiffDate( nNullDate, nStartDate, nEndDate,"
 "nMode, &"
 "nDays1stYear );\n"
-"     return (double)(nTotalDays)*pow((double)nDays1stYear,-1);\n"
+"     return (double)(nTotalDays)/(double)nDays1stYear;\n"
 "}\n";
 
 std::string GetDiffDate360_Decl=
@@ -1380,8 +1380,8 @@ std::string GetDuration_new=
 "        double fNumOfCoups = lcl_Getcoupnum_new(nNullDate,nSettle,nMat,"
 "nFreq,nBase);\n"
 "        double fDur = 0.0;\n"
-"        fCoup = fCoup * 100.0 * pow(nFreq, -1.0);\n"
-"        fYield = fYield * pow(nFreq, -1.0);\n"
+"        fCoup = fCoup * 100.0 / nFreq;\n"
+"        fYield = fYield / nFreq;\n"
 "        fYield += 1.0;\n"
 "        double nDiff = fYearfrac * nFreq - fNumOfCoups;\n"
 "        int  t;\n"
@@ -1389,7 +1389,7 @@ std::string GetDuration_new=
 "        for( t = 1 ; t < fNumOfCoups ; t++ ){\n"
 "            tmp0 = (t + nDiff) * ( fCoup ) ;\n"
 "            tmp1 = pow( fYield, t + nDiff ) ;\n"
-"            tmp2 = tmp0 * pow(tmp1, -1);\n"
+"            tmp2 = tmp0 / tmp1;\n"
 "            fDur += tmp2;\n"
 "        }\n"
 "        fDur += (fNumOfCoups + nDiff) * (fCoup + 100.0) * pow(pow(fYield,"
@@ -1397,10 +1397,10 @@ std::string GetDuration_new=
 "        double  p = 0.0;\n"
 "        for( t = 1 ; t < fNumOfCoups ; t++ ){\n"
 "            tmp0 = pow( fYield, t + nDiff );\n"
-"            p += fCoup * pow(tmp0, -1);}\n"
-"        p += (fCoup + 100.0) * pow(pow(fYield, fNumOfCoups + nDiff), -1);\n"
-"        fDur = fDur * pow(p, -1.0);\n"
-"        fDur = fDur * pow(nFreq, -1.0);\n"
+"            p += fCoup / tmp0;}\n"
+"        p += (fCoup + 100.0) / pow(fYield, fNumOfCoups + nDiff);\n"
+"        fDur = fDur / p;\n"
+"        fDur = fDur / nFreq;\n"
 "        return fDur;\n"
 "    }\n";
 
@@ -1813,7 +1813,7 @@ std::string GetYearDiff_new=
 "    int   nTotalDays = GetDiffDate_new( nNullDate, nStartDate, nEndDate,"
 "nMode, &"
 "nDays1stYear );\n"
-"    return (double)(nTotalDays)* pow((double)nDays1stYear,-1);\n"
+"    return (double)(nTotalDays) / (double)nDays1stYear;\n"
 "}\n";
 
 std::string GetDiffDate_newDecl=
diff --git a/sc/source/core/opencl/opinlinefun_statistical.cxx 
b/sc/source/core/opencl/opinlinefun_statistical.cxx
index f981345df96d..2609fb0ca3bc 100644
--- a/sc/source/core/opencl/opinlinefun_statistical.cxx
+++ b/sc/source/core/opencl/opinlinefun_statistical.cxx
@@ -191,7 +191,7 @@ std::string GetBetaDist =
 "    double flnX = log(fXin);\n"
 "    double fA = fAlpha;\n"
 "    double fB = fBeta;\n"
-"    bool bReflect = fXin > fAlpha*pow((fAlpha+fBeta),-1.0);\n"
+"    bool bReflect = fXin > fAlpha/(fAlpha+fBeta);\n"
 "    if (bReflect)\n"
 "    {\n"
 "        fA = fBeta;\n"
@@ -201,9 +201,9 @@ std::string GetBetaDist =
 "        flnX = flnY;\n"
 "        flnY = log(fXin);\n"
 "    }\n"
-"    fResult = lcl_GetBetaHelperContFrac(fX,fA,fB)*pow(fA,-1.0);\n"
-"    double fP = fA*pow((fA+fB),-1.0);\n"
-"    double fQ = fB*pow((fA+fB),-1.0);\n"
+"    fResult = lcl_GetBetaHelperContFrac(fX,fA,fB)/fA;\n"
+"    double fP = fA/(fA+fB);\n"
+"    double fQ = fB/(fA+fB);\n"
 "    if (fA > 1.0 && fB > 1.0 && fP < 0.97 && fQ < 0.97)\n"
 "        fResult *= GetBetaDistPDF(fX,fA,fB)*fX*fY;\n"
 "    else\n"
@@ -222,9 +222,9 @@ std::string GetFDistDecl =
 std::string GetFDist =
 "double GetFDist(double x, double fF1, double fF2)\n"
 "{\n"
-"    double arg = fF2*pow((fF2+fF1*x),-1.0);\n"
-"    double alpha = fF2*pow(2.0,-1.0);\n"
-"    double beta = fF1*pow(2.0,-1.0);\n"
+"    double arg = fF2/(fF2+fF1*x);\n"
+"    double alpha = fF2/2.0;\n"
+"    double beta = fF1/2.0;\n"
 "    return (GetBetaDist(arg, alpha, beta));\n"
 "}\n";
 std::string GetGammaInvValueDecl = "double"
@@ -236,7 +236,7 @@ std::string GetGammaInvValue =
 "        return 0.0;\n"
 "    else\n"
 "    {\n"
-"        double fX=fX1*pow(fBeta,-1.0);\n"
+"        double fX=fX1/fBeta;\n"
 "        double fLnFactor = fAlpha * log(fX) - fX - lgamma(fAlpha);\n"
 "        double fFactor = exp(fLnFactor);\n"
 "        if (fX>fAlpha+1.0)\n"
@@ -250,9 +250,9 @@ std::string GetFInvValueDecl = "double GetFInvValue(double 
fF1,double fF2"
 std::string GetFInvValue =
 "double GetFInvValue(double fF1,double fF2,double fX1 )\n"
 "{\n"
-"    double arg = fF2*pow((fF2+fF1*fX1),-1.0);\n"
-"    double alpha = fF2*pow(2.0,-1.0);\n"
-"    double beta = fF1*pow(2.0,-1.0);\n"
+"    double arg = fF2/(fF2+fF1*fX1);\n"
+"    double alpha = fF2/2.0;\n"
+"    double beta = fF1/2.0;\n"
 "    double fXin,fAlpha,fBeta;\n"
 "        fXin=arg;fAlpha=alpha;fBeta=beta;\n"
 "    if (fXin <= 0.0)\n"
@@ -270,7 +270,7 @@ std::string GetFInvValue =
 "    double flnX = log(fXin);\n"
 "    double fA = fAlpha;\n"
 "    double fB = fBeta;\n"
-"    bool bReflect = fXin > fAlpha*pow((fAlpha+fBeta),-1.0);\n"
+"    bool bReflect = fXin > fAlpha/(fAlpha+fBeta);\n"
 "    if (bReflect)\n"
 "    {\n"
 "        fA = fBeta;\n"
@@ -281,9 +281,9 @@ std::string GetFInvValue =
 "        flnY = log(fXin);\n"
 "    }\n"
 "    fResult = lcl_GetBetaHelperContFrac(fX,fA,fB);\n"
-"    fResult = fResult*pow(fA,-1.0);\n"
-"    double fP = fA*pow((fA+fB),-1.0);\n"
-"    double fQ = fB*pow((fA+fB),-1.0);\n"
+"    fResult = fResult/fA;\n"
+"    double fP = fA/(fA+fB);\n"
+"    double fQ = fB/(fA+fB);\n"
 "    double fTemp;\n"
 "    if (fA > 1.0 && fB > 1.0 && fP < 0.97 && fQ < 0.97)\n"
 "        fTemp = GetBetaDistPDF(fX,fA,fB)*fX*fY;\n"
@@ -309,12 +309,12 @@ std::string GetBinomDistPMF =
 "   {\n"
 "       fFactor = pow(p, n);\n"
 "       if (fFactor <= Min)\n"
-"           return GetBetaDistPDF(p, x + 1.0, n - x + 1.0)*pow((n + 
1.0),-1.0);\n"
+"           return GetBetaDistPDF(p, x + 1.0, n - x + 1.0)/(n + 1.0);\n"
 "       else\n"
 "       {\n"
 "           uint max = (uint)(n - x);\n"
 "           for (uint i = 0; i < max && fFactor > 0.0; ++i)\n"
-"               fFactor *= (n - i)*pow((i + 1),-1.0)*q*pow(p,-1.0);\n"
+"               fFactor *= (n - i)/(double)(i + 1)*q/p;\n"
 "           return fFactor;\n"
 "       }\n"
 "   }\n"
@@ -322,7 +322,7 @@ std::string GetBinomDistPMF =
 "   {\n"
 "       uint max = (uint)x;\n"
 "       for (uint i = 0; i < max && fFactor > 0.0; ++i)\n"
-"           fFactor *= (n - i)*pow((i + 1),-1.0)*p*pow(q,-1.0);\n"
+"           fFactor *= (n - i)/(double)(i + 1)*p/q;\n"
 "       return fFactor;\n"
 "   }\n"
 "}\n";
@@ -338,12 +338,12 @@ std::string lcl_GetBinomDistRange=
 "   double fSum;\n"
 "   uint nXs = (uint)xs;\n"
 "   for (i = 1; i <= nXs && fFactor > 0.0; ++i)\n"
-"       fFactor *= (n - i + 1)*pow(i,-1.0)*p*pow(q,-1.0);\n"
+"       fFactor *= (n - i + 1)/(double)(i)*p/q;\n"
 "   fSum = fFactor;\n"
 "   uint nXe =(uint)xe;\n"
 "   for (i = nXs + 1; i <= nXe && fFactor > 0.0; ++i)\n"
 "   {\n"
-"       fFactor *= (n - i + 1)*pow(i,-1.0)*p*pow(q,-1.0);\n"
+"       fFactor *= (n - i + 1)/(double)(i)*p/q;\n"
 "       fSum += fFactor;\n"
 "   }\n"
 "   return (fSum > 1.0) ? 1.0 : fSum;\n"
@@ -358,7 +358,7 @@ std::string GetLogGamma =
 "   if (fZ >= 1.0)\n"
 "       return log(lcl_GetGammaHelper(fZ));\n"
 "   if (fZ >= 0.5)\n"
-"       return log( lcl_GetGammaHelper(fZ+1) *pow(fZ,-1.0));\n"
+"       return log( lcl_GetGammaHelper(fZ+1) / fZ);\n"
 "   return lcl_GetLogGammaHelper(fZ+2) - log(fZ+1) - log(fZ);\n"
 "}\n";
 
@@ -369,7 +369,7 @@ std::string GetChiDist =
 "   if (fX <= 0.0)\n"
 "       return  1.0;\n"
 "   else\n"
-"       return GetUpRegIGamma( fDF*pow(2.0,-1.0), fX*pow(2.0,-1.0));\n"
+"       return GetUpRegIGamma( fDF/2.0, fX/2.0);\n"
 "}\n";
 
 std::string GetChiSqDistCDFDecl =
@@ -380,7 +380,7 @@ std::string GetChiSqDistCDF =
 "   if (fX <= 0.0)\n"
 "       return 0.0;"
 "   else\n"
-"       return GetLowRegIGamma( fDF*pow(2.0,-1.0), fX*pow(2.0,-1.0));\n"
+"       return GetLowRegIGamma( fDF/2.0, fX/2.0);\n"
 "}\n";
 
 std::string GetChiSqDistPDFDecl=
@@ -406,18 +406,18 @@ std::string GetChiSqDistPDF =
 "       }\n"
 "       else\n"
 "       {\n"
-"           fValue = pow(sqrt(fX*2*M_PI),-1.0);\n"
+"           fValue = 1.0/sqrt(fX*2*M_PI);\n"
 "           fCount = 1.0;\n"
 "       }\n"
 "       while ( fCount < fDF)\n"
 "       {\n"
-"           fValue *= (fX *pow(fCount,-1.0));\n"
+"           fValue *= (fX / fCount);\n"
 "           fCount += 2.0;\n"
 "       }\n"
 "       if (fX>=1425.0)\n"
-"           fValue = exp(log(fValue)-fX*pow(2,-1.0));\n"
+"           fValue = exp(log(fValue)-fX/2);\n"
 "       else\n"
-"           fValue *= exp(-fX*pow(2,-1.0));\n"
+"           fValue *= exp(-fX/2);\n"
 "   }\n"
 "    return fValue;\n"
 "}\n";
@@ -487,9 +487,9 @@ std::string lcl_IterateInverseBetaInv =
 "       {\n"
 "           if (fPy!=fQy && fQy!=fRy && fRy!=fPy)\n"
 "           {\n"
-"               fSx = fPx*fRy*fQy*pow(fRy-fPy,-1.0)*pow(fQy-fPy,-1.0)\n"
-"                   + fRx*fQy*fPy*pow(fQy-fRy,-1.0)*pow(fPy-fRy,-1.0)\n"
-"                   + fQx*fPy*fRy*pow(fPy-fQy,-1.0)*pow(fRy-fQy,-1.0);\n"
+"               fSx = fPx*fRy*fQy/(fRy-fPy)/(fQy-fPy)\n"
+"                   + fRx*fQy*fPy/(fQy-fRy)/(fPy-fRy)\n"
+"                   + fQx*fPy*fRy/(fPy-fQy)/(fRy-fQy);\n"
 "               bHasToInterpolate = (fAx < fSx) && (fSx < fBx);\n"
 "           }\n"
 "           else\n"
@@ -584,9 +584,9 @@ std::string lcl_IterateInverseChiInv =
 "       {\n"
 "           if (fPy!=fQy && fQy!=fRy && fRy!=fPy)\n"
 "           {\n"
-"               fSx = fPx * fRy * fQy*pow(fRy-fPy,-1.0)*pow(fQy-fPy,-1.0)\n"
-"                   + fRx * fQy * fPy*pow(fQy-fRy,-1.0)*pow(fPy-fRy,-1.0)\n"
-"                   + fQx * fPy * fRy*pow(fPy-fQy,-1.0)*pow(fRy-fQy,-1.0);\n"
+"               fSx = fPx * fRy * fQy/(fRy-fPy)/(fQy-fPy)\n"
+"                   + fRx * fQy * fPy/(fQy-fRy)/(fPy-fRy)\n"
+"                   + fQx * fPy * fRy/(fPy-fQy)/(fRy-fQy);\n"
 "               bHasToInterpolate = (fAx < fSx) && (fSx < fBx);\n"
 "           }\n"
 "           else\n"
@@ -892,9 +892,9 @@ std::string lcl_GetGammaHelper =
 "   double fGamma = lcl_getLanczosSum(fZ);\n"
 "   double fg = 6.024680040776729583740234375;\n"
 "   double fZgHelp = fZ + fg - 0.5;\n"
-"   double fHalfpower = pow( fZgHelp, fZ*pow(2,-1.0) - 0.25);\n"
+"   double fHalfpower = pow( fZgHelp, fZ/2 - 0.25);\n"
 "   fGamma *= fHalfpower;\n"
-"   fGamma = fGamma*pow(exp(fZgHelp),-1.0);\n"
+"   fGamma = fGamma/exp(fZgHelp);\n"
 "   fGamma *= fHalfpower;\n"
 "   fGamma = 120.4;\n"
 "   if (fZ <= 20.0 && fZ == (int)fZ)\n"
@@ -984,7 +984,7 @@ std::string lcl_getLanczosSum =
 "    }\n"
 "    if (fZ>1.0)\n"
 "    {\n"
-"        double fZInv = pow(fZ,-1.0);\n"
+"        double fZInv = 1.0/fZ;\n"
 "        fSumNum = fNum[0];\n"
 "        fSumDenom = fDenom[0];\n"
 "        nI = 1;\n"
@@ -1024,7 +1024,7 @@ std::string lcl_getLanczosSum =
 "        fSumNum = fSumNum*fZInv+fNum[nI];\n"
 "        fSumDenom = fSumDenom*fZInv+fDenom[nI];\n"
 "     }\n"
-"     return fSumNum*pow(fSumDenom,-1.0);\n"
+"     return fSumNum/fSumDenom;\n"
 "}\n";
 
 std::string GetUpRegIGammaDecl=
@@ -1052,7 +1052,7 @@ std::string GetTDistDecl=" double GetTDist(double T, 
double fDF);\n";
 std::string GetTDist =
 "double GetTDist(double T, double fDF)\n"
 "{\n"
-"    return 0.5 * GetBetaDist(fDF*pow(fDF+T*T,-1.0),fDF*pow(2.0,-1.0), 0.5);\n"
+"    return 0.5 * GetBetaDist(fDF/(fDF+T*T),fDF/2.0, 0.5);\n"
 "}\n";
 
 std::string GetBetaDecl=" double GetBeta(double fAlpha, double fBeta);\n";
@@ -1065,13 +1065,13 @@ std::string GetBeta =
 "    double fAB = fA + fB;\n"
 
 "    if (fAB < fMaxGammaArgument)\n"
-"        return tgamma(fA)*pow(tgamma(fAB),-1.0)*tgamma(fB);\n"
+"        return tgamma(fA)/tgamma(fAB)*tgamma(fB);\n"
 "    double fgm = 5.524680040776729583740234375;\n"
 "    double fLanczos = lcl_getLanczosSum(fA)*lcl_getLanczosSum(fB)\n"
-"        *pow(lcl_getLanczosSum(fAB),-1.0);\n"
-"    fLanczos *= sqrt(((fAB + fgm)*pow(fA + fgm,-1.0))*pow(fB + fgm,-1.0));\n"
-"    return fLanczos * pow(exp(1.0),(-fA*log1p(fB*pow(fA + fgm,-1.0)))"
-"                    - fB*log1p(fA*pow(fB + fgm,-1.0)) - fgm);\n"
+"        /lcl_getLanczosSum(fAB);\n"
+"    fLanczos *= sqrt(((fAB + fgm)/(fA + fgm))/(fB + fgm));\n"
+"    return fLanczos * pow(exp(1.0),(-fA*log1p(fB/(fA + fgm)))"
+"                    - fB*log1p(fA/(fB + fgm)) - fgm);\n"
 "}\n";
 
 std::string GetLogBetaDecl=
@@ -1084,10 +1084,10 @@ std::string GetLogBeta =
 "    fAlpha>fBeta?(fA = fAlpha,fB = fBeta):(fA = fBeta,fB = fAlpha);\n"
 "    double fgm = 5.524680040776729583740234375;\n"
 
-"    double fLanczos = lcl_getLanczosSum(fA)*lcl_getLanczosSum(fB)*\n"
-"        pow(lcl_getLanczosSum(fA + fB),-1.0);\n"
-"    double fResult= -fA *log1p(fB*pow(fA + fgm,-1.0))"
-"-fB *log1p(fA*pow(fB + fgm,-1.0))-fgm;\n"
+"    double fLanczos = lcl_getLanczosSum(fA)*lcl_getLanczosSum(fB)\n"
+"        /lcl_getLanczosSum(fA + fB);\n"
+"    double fResult= -fA *log1p(fB/(fA + fgm))"
+"-fB *log1p(fA/(fB + fgm))-fgm;\n"
 "    fResult += log(fLanczos)+0.5*(log(fA + fB + fgm) - log(fA + fgm)\n"
 "        - log(fB + fgm));\n"
 "    return fResult;\n"
@@ -1153,8 +1153,7 @@ std::string GetBetaDistPDF =
 "        && fLogBeta < fLogDblMax  && fLogBeta > fLogDblMin\n"
 "        && fAm1LogX + fBm1LogY < fLogDblMax && fAm1LogX + fBm1LogY > \n"
 "           fLogDblMin)\n"
-"        return pow(fX,fA-1.0)*pow(0.5-fX+0.5,fB-1.0)"
-"*pow(GetBeta(fA,fB),-1.0);\n"
+"        return pow(fX,fA-1.0)*pow(0.5-fX+0.5,fB-1.0)/GetBeta(fA,fB);\n"
 "    else \n"
 "         return exp( fAm1LogX + fBm1LogY - fLogBeta);\n"
 "}\n";
@@ -1167,9 +1166,9 @@ std::string lcl_GetBetaHelperContFrac =
 
 "    double a1, b1, a2, b2, fnorm, apl2m, d2m, d2m1, cfnew, cf;\n"
 "    a1 = 1.0; b1 = 1.0;\n"
-"    b2 = 1.0 - (fA+fB)*pow(fA+1.0,-1.0)*fX;\n"
+"    b2 = 1.0 - (fA+fB)/(fA+1.0)*fX;\n"
 "    b2==0.0?(a2 = 0.0,fnorm = 1.0,cf = 1.0):\n"
-"        (a2 = 1.0,fnorm = pow(b2,-1.0),cf = a2*fnorm);\n"
+"        (a2 = 1.0,fnorm = 1.0/b2,cf = a2*fnorm);\n"
 "    cfnew = 1.0;\n"
 "    double rm = 1.0;\n"
 "    double fMaxIter = 50000.0;\n"
@@ -1177,15 +1176,15 @@ std::string lcl_GetBetaHelperContFrac =
 "    do\n"
 "    {\n"
 "      apl2m = fA + 2.0*rm;\n"
-"      d2m = (rm*(fB-rm))*fX*pow(apl2m*(apl2m-1.0),-1.0);\n"
-"      d2m1 = -((fA+rm)*(fA+rm+fB))*fX*pow(apl2m*(apl2m+1.0),-1.0);\n"
+"      d2m = (rm*(fB-rm))*fX/(apl2m*(apl2m-1.0));\n"
+"      d2m1 = -((fA+rm)*(fA+rm+fB))*fX/(apl2m*(apl2m+1.0));\n"
 "      a1 = (a2+d2m*a1)*fnorm;\n"
 "      b1 = (b2+d2m*b1)*fnorm;\n"
 "      a2 = a1 + d2m1*a2*fnorm;\n"
 "      b2 = b1 + d2m1*b2*fnorm;\n"
 "      if (b2 != 0.0) \n"
 "      {\n"
-"        fnorm = pow(b2,-1.0);\n"
+"        fnorm = 1.0/b2;\n"
 "        cfnew = a2*fnorm;\n"
 "        bfinished = (fabs(cf-cfnew) < fabs(cf)*fMachEps);\n"
 "      }\n"
@@ -1265,9 +1264,9 @@ std::string lcl_IterateInverse =
 "        {\n"
 "           if (fPy!=fQy && fQy!=fRy && fRy!=fPy)\n"
 "           {\n"
-"               fSx = fPx * fRy * fQy * pow(fRy-fPy,-1.0)*pow(fQy-fPy,-1.0)\n"
-"                   + fRx * fQy * fPy * pow(fQy-fRy,-1.0)*pow(fPy-fRy,-1.0)\n"
-"                   + fQx * fPy * fRy * pow(fPy-fQy,-1.0)*pow(fRy-fQy,-1.0);\n"
+"               fSx = fPx * fRy * fQy / (fRy-fPy) / (fQy-fPy)\n"
+"                   + fRx * fQy * fPy / (fQy-fRy) / (fPy-fRy)\n"
+"                   + fQx * fPy * fRy / (fPy-fQy) / (fRy-fQy);\n"
 "               bHasToInterpolate = (fAx < fSx) && (fSx < fBx);\n"
 "           }\n"
 "            else\n"

Reply via email to