Skip to content
Permalink
Browse files

Merge branch 'fix_constants_in_compiled_coefficients' into 'master'

float-accuracy for constants in compiled coefficientfunctions

See merge request !235
  • Loading branch information
JSchoeberl committed Sep 21, 2017
2 parents dc1159a + 3bd6576 commit a350733ad8d4420f326e92d33f7c6dc45a2ecff4
Showing with 15 additions and 7 deletions.
  1. +14 −7 fem/code_generation.hpp
  2. +1 −0 ngstd/templates.hpp
@@ -89,17 +89,24 @@ namespace ngfem

inline CodeExpr Var(double val)
{
return CodeExpr(ToString(val));
stringstream ss;
ss << ToString(val);
ss << " /* (" << std::setprecision(16);
ss << val << ") */";
return ss.str();
}

inline CodeExpr Var(Complex val)
{
string res("Complex(");
res += ToString(val.real());
res += ",";
res += ToString(val.imag());
res += ")";
return res;
stringstream ss;
ss << "Complex(";
ss << ToString(val.real());
ss << ",";
ss << ToString(val.imag());
ss << ")";
ss << " /* (" << std::setprecision(16);
ss << val.real() << ", " << val.imag() << ") */";
return ss.str();
}

inline CodeExpr Var(string name, int i, int j=0, int k=0)
@@ -84,6 +84,7 @@ template <class T>
inline string ToString (const T& t)
{
stringstream ss;
ss << std::hexfloat;
ss << t;
return ss.str();
}

0 comments on commit a350733

Please sign in to comment.
You can’t perform that action at this time.