Salome HOME
Get relevant changes from V7_dev branch (copyright update, adm files etc)
[tools/medcoupling.git] / src / INTERP_KERNEL / ExprEval / InterpKernelFunction.cxx
index 6e4f13e7b0fbce0157cfa5374c8ba782f378714a..c3ddbac4657fe17d872e1bfa63d5d571b4c2f638 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,6 +22,7 @@
 #include "InterpKernelValue.hxx"
 
 #include <cmath>
+#include <limits>
 
 using namespace INTERP_KERNEL;
 
@@ -81,7 +82,7 @@ const char LowerThanFunction::REPR[]="<";
 
 const char IfFunction::REPR[]="if";
 
-Function *FunctionsFactory::buildFuncFromString(const char *type, int nbOfParams) throw(INTERP_KERNEL::Exception)
+Function *FunctionsFactory::buildFuncFromString(const char *type, int nbOfParams)
 {
   switch(nbOfParams)
     {
@@ -96,7 +97,7 @@ Function *FunctionsFactory::buildFuncFromString(const char *type, int nbOfParams
     }
 }
 
-Function *FunctionsFactory::buildUnaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception)
+Function *FunctionsFactory::buildUnaryFuncFromString(const char *type)
 {
   std::string tmp(type);
   if(tmp.empty())
@@ -141,7 +142,7 @@ Function *FunctionsFactory::buildUnaryFuncFromString(const char *type) throw(INT
   throw INTERP_KERNEL::Exception(msg.c_str());
 }
 
-Function *FunctionsFactory::buildBinaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception)
+Function *FunctionsFactory::buildBinaryFuncFromString(const char *type)
 {
   std::string tmp(type);
   if(tmp==PositiveFunction::REPR)
@@ -167,7 +168,7 @@ Function *FunctionsFactory::buildBinaryFuncFromString(const char *type) throw(IN
   throw INTERP_KERNEL::Exception(msg.c_str());
 }
 
-Function *FunctionsFactory::buildTernaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception)
+Function *FunctionsFactory::buildTernaryFuncFromString(const char *type)
 {
   std::string tmp(type);
   if(tmp==IfFunction::REPR)
@@ -177,7 +178,7 @@ Function *FunctionsFactory::buildTernaryFuncFromString(const char *type) throw(I
   throw INTERP_KERNEL::Exception(msg.c_str());
 }
 
-Function *FunctionsFactory::buildBinaryFuncFromString(char type) throw(INTERP_KERNEL::Exception)
+Function *FunctionsFactory::buildBinaryFuncFromString(char type)
 {
   char tmp[2]; tmp[0]=type; tmp[1]='\0';
   return buildBinaryFuncFromString(tmp);
@@ -191,11 +192,15 @@ IdentityFunction::~IdentityFunction()
 {
 }
 
-void IdentityFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void IdentityFunction::operate(std::vector<Value *>& stck) const
 {
 }
 
-void IdentityFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void IdentityFunction::operateX86(std::vector<std::string>& asmb) const
+{
+}
+
+void IdentityFunction::operateStackOfDouble(std::vector<double>& stck) const
 {
 }
 
@@ -218,11 +223,15 @@ int UnaryFunction::getNbInputParams() const
   return 1;
 }
 
-void PositiveFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void PositiveFunction::operate(std::vector<Value *>& stck) const
 {
 }
 
-void PositiveFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void PositiveFunction::operateX86(std::vector<std::string>& asmb) const
+{
+}
+
+void PositiveFunction::operateStackOfDouble(std::vector<double>& stck) const
 {
 }
 
@@ -240,17 +249,23 @@ NegateFunction::~NegateFunction()
 {
 }
 
-void NegateFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void NegateFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->negate();
 }
 
-void NegateFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void NegateFunction::operateX86(std::vector<std::string>& asmb) const
 {
   asmb.push_back("fchs");
 }
 
+void NegateFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=-v;
+}
+
 const char *NegateFunction::getRepr() const
 {
   return REPR;
@@ -265,17 +280,23 @@ CosFunction::~CosFunction()
 {
 }
 
-void CosFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void CosFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->cos();
 }
 
-void CosFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void CosFunction::operateX86(std::vector<std::string>& asmb) const
 {
   asmb.push_back("fcos");
 }
 
+void CosFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=cos(v);
+}
+
 const char *CosFunction::getRepr() const
 {
   return REPR;
@@ -290,17 +311,23 @@ SinFunction::~SinFunction()
 {
 }
 
-void SinFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void SinFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->sin();
 }
 
-void SinFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void SinFunction::operateX86(std::vector<std::string>& asmb) const
 {
   asmb.push_back("fsin");
 }
 
+void SinFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=sin(v);
+}
+
 const char *SinFunction::getRepr() const
 {
   return REPR;
@@ -315,17 +342,23 @@ TanFunction::~TanFunction()
 {
 }
 
-void TanFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void TanFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->tan();
 }
 
-void TanFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void TanFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void TanFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=tan(v);
+}
+
 const char *TanFunction::getRepr() const
 {
   return REPR;
@@ -340,17 +373,31 @@ ACosFunction::~ACosFunction()
 {
 }
 
-void ACosFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void ACosFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->acos();
 }
 
-void ACosFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void ACosFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void ACosFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=acos(v);
+}
+
+void ACosFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  if(fabs(v)>1.)
+    throw INTERP_KERNEL::Exception("acos on a value which absolute is > 1 !");
+  stck.back()=acos(v);
+}
+
 const char *ACosFunction::getRepr() const
 {
   return REPR;
@@ -365,17 +412,31 @@ ASinFunction::~ASinFunction()
 {
 }
 
-void ASinFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void ASinFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->asin();
 }
 
-void ASinFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void ASinFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void ASinFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=asin(v);
+}
+
+void ASinFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  if(fabs(v)>1.)
+    throw INTERP_KERNEL::Exception("asin on a value which absolute is > 1 !");
+  stck.back()=asin(v);
+}
+
 const char *ASinFunction::getRepr() const
 {
   return REPR;
@@ -390,17 +451,23 @@ ATanFunction::~ATanFunction()
 {
 }
 
-void ATanFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void ATanFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->atan();
 }
 
-void ATanFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void ATanFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void ATanFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=atan(v);
+}
+
 const char *ATanFunction::getRepr() const
 {
   return REPR;
@@ -415,17 +482,23 @@ CoshFunction::~CoshFunction()
 {
 }
 
-void CoshFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void CoshFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->cosh();
 }
 
-void CoshFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void CoshFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void CoshFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=cosh(v);
+}
+
 const char *CoshFunction::getRepr() const
 {
   return REPR;
@@ -440,17 +513,23 @@ SinhFunction::~SinhFunction()
 {
 }
 
-void SinhFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void SinhFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->sinh();
 }
 
-void SinhFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void SinhFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void SinhFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=sinh(v);
+}
+
 const char *SinhFunction::getRepr() const
 {
   return REPR;
@@ -465,17 +544,23 @@ TanhFunction::~TanhFunction()
 {
 }
 
-void TanhFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void TanhFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->tanh();
 }
 
-void TanhFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void TanhFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void TanhFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=tanh(v);
+}
+
 const char *TanhFunction::getRepr() const
 {
   return REPR;
@@ -490,17 +575,31 @@ SqrtFunction::~SqrtFunction()
 {
 }
 
-void SqrtFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void SqrtFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->sqrt();
 }
 
-void SqrtFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void SqrtFunction::operateX86(std::vector<std::string>& asmb) const
 {
   asmb.push_back("fsqrt");
 }
 
+void SqrtFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=sqrt(v);
+}
+
+void SqrtFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  if(v<0.)
+    throw INTERP_KERNEL::Exception("sqrt on a value < 0. !");
+  stck.back()=sqrt(v);
+}
+
 const char *SqrtFunction::getRepr() const
 {
   return REPR;
@@ -515,17 +614,23 @@ AbsFunction::~AbsFunction()
 {
 }
 
-void AbsFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void AbsFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->abs();
 }
 
-void AbsFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void AbsFunction::operateX86(std::vector<std::string>& asmb) const
 {
   asmb.push_back("fabs");
 }
 
+void AbsFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=fabs(v);
+}
+
 const char *AbsFunction::getRepr() const
 {
   return REPR;
@@ -536,17 +641,23 @@ bool AbsFunction::isACall() const
   return false;
 }
 
-void ExpFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void ExpFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->exp();
 }
 
-void ExpFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void ExpFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void ExpFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=std::exp(v);
+}
+
 const char *ExpFunction::getRepr() const
 {
   return REPR;
@@ -561,17 +672,31 @@ LnFunction::~LnFunction()
 {
 }
 
-void LnFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void LnFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->ln();
 }
 
-void LnFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void LnFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void LnFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=std::log(v);
+}
+
+void LnFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  if(v<0.)
+    throw INTERP_KERNEL::Exception("ln on a value < 0. !");
+  stck.back()=std::log(v);
+}
+
 const char *LnFunction::getRepr() const
 {
   return REPR;
@@ -586,17 +711,31 @@ LogFunction::~LogFunction()
 {
 }
 
-void LogFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void LogFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->ln();
 }
 
-void LogFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void LogFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly for log Not implemented yet !");
 }
 
+void LogFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=std::log(v);
+}
+
+void LogFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  if(v<0.)
+    throw INTERP_KERNEL::Exception("log on a value < 0. !");
+  stck.back()=std::log(v);
+}
+
 const char *LogFunction::getRepr() const
 {
   return REPR;
@@ -611,17 +750,31 @@ Log10Function::~Log10Function()
 {
 }
 
-void Log10Function::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void Log10Function::operate(std::vector<Value *>& stck) const
 {
-  Value *val=stack.back();
+  Value *val=stck.back();
   val->log10();
 }
 
-void Log10Function::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void Log10Function::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly for log Not implemented yet !");
 }
 
+void Log10Function::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  stck.back()=std::log10(v);
+}
+
+void Log10Function::operateStackOfDoubleSafe(std::vector<double>& stck) const
+{
+  double v(stck.back());
+  if(v<0.)
+    throw INTERP_KERNEL::Exception("log10 on a value < 0. !");
+  stck.back()=std::log10(v);
+}
+
 const char *Log10Function::getRepr() const
 {
   return REPR;
@@ -641,11 +794,11 @@ PlusFunction::~PlusFunction()
 {
 }
 
-void PlusFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void PlusFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val1=stack.back();
-  stack.pop_back();
-  Value *& val2=stack.back();
+  Value *val1=stck.back();
+  stck.pop_back();
+  Value *& val2=stck.back();
   Value *val3;
   try
     {
@@ -661,11 +814,18 @@ void PlusFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNE
   val2=val3;
 }
 
-void PlusFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void PlusFunction::operateX86(std::vector<std::string>& asmb) const
 {
   asmb.push_back("faddp st1");
 }
 
+void PlusFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double a(stck.back());
+  stck.pop_back();
+  stck.back()=a+stck.back();
+}
+
 const char *PlusFunction::getRepr() const
 {
   return REPR;
@@ -680,11 +840,11 @@ MinusFunction::~MinusFunction()
 {
 }
 
-void MinusFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void MinusFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val1=stack.back();
-  stack.pop_back();
-  Value *& val2=stack.back();
+  Value *val1=stck.back();
+  stck.pop_back();
+  Value *& val2=stck.back();
   Value *val3;
   try
     {
@@ -700,11 +860,18 @@ void MinusFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERN
   val2=val3;
 }
 
-void MinusFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void MinusFunction::operateX86(std::vector<std::string>& asmb) const
 {
   asmb.push_back("fsubp st1");
 }
 
+void MinusFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double a(stck.back());
+  stck.pop_back();
+  stck.back()=a-stck.back();
+}
+
 const char *MinusFunction::getRepr() const
 {
   return REPR;
@@ -719,22 +886,29 @@ MultFunction::~MultFunction()
 {
 }
 
-void MultFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void MultFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val1=stack.back();
-  stack.pop_back();
-  Value *& val2=stack.back();
+  Value *val1=stck.back();
+  stck.pop_back();
+  Value *& val2=stck.back();
   Value *val3=val1->mult(val2);
   delete val1;
   delete val2;
   val2=val3;
 }
 
-void MultFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void MultFunction::operateX86(std::vector<std::string>& asmb) const
 {
   asmb.push_back("fmulp st1");
 }
 
+void MultFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double a(stck.back());
+  stck.pop_back();
+  stck.back()=a*stck.back();
+}
+
 const char *MultFunction::getRepr() const
 {
   return REPR;
@@ -749,11 +923,11 @@ DivFunction::~DivFunction()
 {
 }
 
-void DivFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void DivFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val1=stack.back();
-  stack.pop_back();
-  Value *& val2=stack.back();
+  Value *val1=stck.back();
+  stck.pop_back();
+  Value *& val2=stck.back();
   Value *val3;
   try
     {
@@ -769,11 +943,27 @@ void DivFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL
   val2=val3;
 }
 
-void DivFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void DivFunction::operateX86(std::vector<std::string>& asmb) const
 {
   asmb.push_back("fdivp st1");
 }
 
+void DivFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double a(stck.back());
+  stck.pop_back();
+  stck.back()=a/stck.back();
+}
+
+void DivFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
+{
+  double a(stck.back());
+  stck.pop_back();
+  if(stck.back()==0.)
+    throw INTERP_KERNEL::Exception("division by 0. !");
+  stck.back()=a/stck.back();
+}
+
 const char *DivFunction::getRepr() const
 {
   return REPR;
@@ -788,11 +978,11 @@ PowFunction::~PowFunction()
 {
 }
 
-void PowFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void PowFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val1=stack.back();
-  stack.pop_back();
-  Value *& val2=stack.back();
+  Value *val1=stck.back();
+  stck.pop_back();
+  Value *& val2=stck.back();
   Value *val3;
   try
     {
@@ -808,11 +998,28 @@ void PowFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL
   val2=val3;
 }
 
-void PowFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void PowFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void PowFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double a(stck.back());
+  stck.pop_back();
+  stck.back()=std::pow(a,stck.back());
+}
+
+void PowFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
+{
+  double a(stck.back());
+  stck.pop_back();
+  double b(stck.back());
+  if(a<0.)
+    throw INTERP_KERNEL::Exception("pow with val < 0. !");
+  stck.back()=std::pow(a,b);
+}
+
 const char *PowFunction::getRepr() const
 {
   return REPR;
@@ -831,11 +1038,11 @@ MaxFunction::~MaxFunction()
 {
 }
 
-void MaxFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void MaxFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val1=stack.back();
-  stack.pop_back();
-  Value *& val2=stack.back();
+  Value *val1=stck.back();
+  stck.pop_back();
+  Value *& val2=stck.back();
   Value *val3;
   try
     {
@@ -851,11 +1058,18 @@ void MaxFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL
   val2=val3;
 }
 
-void MaxFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void MaxFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void MaxFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double a(stck.back());
+  stck.pop_back();
+  stck.back()=std::max(stck.back(),a);
+}
+
 const char *MaxFunction::getRepr() const
 {
   return REPR;
@@ -870,11 +1084,11 @@ MinFunction::~MinFunction()
 {
 }
 
-void MinFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void MinFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val1=stack.back();
-  stack.pop_back();
-  Value *& val2=stack.back();
+  Value *val1=stck.back();
+  stck.pop_back();
+  Value *& val2=stck.back();
   Value *val3;
   try
     {
@@ -890,11 +1104,18 @@ void MinFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL
   val2=val3;
 }
 
-void MinFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void MinFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void MinFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double a(stck.back());
+  stck.pop_back();
+  stck.back()=std::min(stck.back(),a);
+}
+
 const char *MinFunction::getRepr() const
 {
   return REPR;
@@ -909,11 +1130,11 @@ GreaterThanFunction::~GreaterThanFunction()
 {
 }
 
-void GreaterThanFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void GreaterThanFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val1=stack.back();
-  stack.pop_back();
-  Value *& val2=stack.back();
+  Value *val1=stck.back();
+  stck.pop_back();
+  Value *& val2=stck.back();
   Value *val3;
   try
     {
@@ -929,11 +1150,19 @@ void GreaterThanFunction::operate(std::vector<Value *>& stack) const throw(INTER
   val2=val3;
 }
 
-void GreaterThanFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void GreaterThanFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void GreaterThanFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double a(stck.back());
+  stck.pop_back();
+  double b(stck.back());
+  stck.back()=a>b?std::numeric_limits<double>::max():-std::numeric_limits<double>::max();
+}
+
 const char *GreaterThanFunction::getRepr() const
 {
   return REPR;
@@ -948,11 +1177,11 @@ LowerThanFunction::~LowerThanFunction()
 {
 }
 
-void LowerThanFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void LowerThanFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val1=stack.back();
-  stack.pop_back();
-  Value *& val2=stack.back();
+  Value *val1=stck.back();
+  stck.pop_back();
+  Value *& val2=stck.back();
   Value *val3;
   try
     {
@@ -968,11 +1197,19 @@ void LowerThanFunction::operate(std::vector<Value *>& stack) const throw(INTERP_
   val2=val3;
 }
 
-void LowerThanFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void LowerThanFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void LowerThanFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double a(stck.back());
+  stck.pop_back();
+  double b(stck.back());
+  stck.back()=a<b?std::numeric_limits<double>::max():-std::numeric_limits<double>::max();
+}
+
 const char *LowerThanFunction::getRepr() const
 {
   return REPR;
@@ -992,13 +1229,13 @@ IfFunction::~IfFunction()
 {
 }
 
-void IfFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void IfFunction::operate(std::vector<Value *>& stck) const
 {
-  Value *val1=stack.back();
-  stack.pop_back();
-  Value *val2=stack.back();
-  stack.pop_back();
-  Value *&val3=stack.back();
+  Value *val1=stck.back();
+  stck.pop_back();
+  Value *val2=stck.back();
+  stck.pop_back();
+  Value *&val3=stck.back();
   Value *val4;
   try
     {
@@ -1016,11 +1253,33 @@ void IfFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL:
   val3=val4;
 }
 
-void IfFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void IfFunction::operateX86(std::vector<std::string>& asmb) const
 {
   throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
 }
 
+void IfFunction::operateStackOfDouble(std::vector<double>& stck) const
+{
+  double cond(stck.back());
+  stck.pop_back();
+  double the(stck.back());
+  stck.pop_back();
+  if(cond==std::numeric_limits<double>::max())
+    stck.back()=the;
+}
+
+void IfFunction::operateStackOfDoubleSafe(std::vector<double>& stck) const
+{
+  double cond(stck.back());
+  stck.pop_back();
+  double the(stck.back());
+  stck.pop_back();
+  if(cond!=std::numeric_limits<double>::max() && cond!=-std::numeric_limits<double>::max())
+    throw INTERP_KERNEL::Exception("ifFunc : first parameter of ternary func is NOT a consequence of a boolean op !");
+  if(cond==std::numeric_limits<double>::max())
+    stck.back()=the;
+}
+
 const char *IfFunction::getRepr() const
 {
   return REPR;