Skip to content
Snippets Groups Projects
Commit 5dbefe66 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Use std::log

parent d7ad69b6
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,7 @@ class RuinaFunction : public NiceFunction {
mu(mu),
eta(eta),
normalStress(normalStress),
compound_state(b * (state - log(eta * L))),
compound_state(b * (state - std::log(eta * L))),
h(h),
rho(exp(-(mu + compound_state) / a)) {}
......@@ -58,10 +58,10 @@ class RuinaFunction : public NiceFunction {
void virtual evaluate(double const &x, double &y) const {
double const arg = eta * x / h;
if (arg <= rho) {
y = -log(rho); // TODO: We can write this out explicitly
y = -std::log(rho); // TODO: We can write this out explicitly
return;
}
y = arg * (log(arg) - 1) - arg * log(rho) + rho - log(rho);
y = arg * (std::log(arg) - 1) - arg * std::log(rho) + rho - std::log(rho);
y *= coefficient * h * normalStress / eta;
}
......@@ -210,25 +210,26 @@ class HorribleFunctionLogarithmic : public NiceFunction {
y = 0;
size_t const fl = floor(x);
for (size_t i = 1; i <= fl;)
y += log(++i); // factorials grow to fast so we compute this incrementally
y += std::log(
++i); // factorials grow to fast so we compute this incrementally
y += log(fl + 2) * (x - fl);
y += std::log(fl + 2) * (x - fl);
}
double virtual leftDifferential(double x) const {
double const fl = floor(x);
if (x - fl < 1e-14)
return log(fl + 1);
return std::log(fl + 1);
else
return log(fl + 2);
return std::log(fl + 2);
}
double virtual rightDifferential(double x) const {
double const c = ceil(x);
if (c - x < 1e-14)
return log(c + 2);
return std::log(c + 2);
else
return log(c + 1);
return std::log(c + 1);
}
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment