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

Use std::exp() instead of exp()

parent d457f3e0
Branches
Tags
No related merge requests found
...@@ -17,11 +17,11 @@ class DecayingExponential { ...@@ -17,11 +17,11 @@ class DecayingExponential {
typedef Dune::FieldVector<double, 1> VectorType; typedef Dune::FieldVector<double, 1> VectorType;
typedef Dune::FieldMatrix<double, 1, 1> MatrixType; typedef Dune::FieldMatrix<double, 1, 1> MatrixType;
double operator()(VectorType const &u) const { return exp(-u[0]); } double operator()(VectorType const &u) const { return std::exp(-u[0]); }
void directionalSubDiff(VectorType const &u, VectorType const &v, void directionalSubDiff(VectorType const &u, VectorType const &v,
Interval<double> &D) const { Interval<double> &D) const {
D[0] = D[1] = v[0] * (-exp(-u[0])); D[0] = D[1] = v[0] * (-std::exp(-u[0]));
} }
void directionalDomain(VectorType const &, VectorType const &, void directionalDomain(VectorType const &, VectorType const &,
...@@ -43,7 +43,7 @@ double compute_state_update_bisection(double h, double unorm, double L, ...@@ -43,7 +43,7 @@ double compute_state_update_bisection(double h, double unorm, double L,
double compute_state_update_lambert(double h, double unorm, double L, double compute_state_update_lambert(double h, double unorm, double L,
double old_state) { double old_state) {
double const rhs = unorm / L - old_state; double const rhs = unorm / L - old_state;
return LambertW(0, h * exp(rhs)) - rhs; return LambertW(0, h * std::exp(rhs)) - rhs;
} }
double compute_state_update_lambert_gsl(double h, double unorm, double L, double compute_state_update_lambert_gsl(double h, double unorm, double L,
......
...@@ -353,17 +353,17 @@ int main(int argc, char *argv[]) { ...@@ -353,17 +353,17 @@ int main(int argc, char *argv[]) {
double ret1 = double ret1 =
compute_state_update_bisection(h, unorm, L, s4_old[i][0]); compute_state_update_bisection(h, unorm, L, s4_old[i][0]);
assert(std::abs(1.0 / h * ret1 - (s4_old[i] - unorm / L) / h - assert(std::abs(1.0 / h * ret1 - (s4_old[i] - unorm / L) / h -
exp(-ret1)) < 1e-10); std::exp(-ret1)) < 1e-10);
double ret2 = double ret2 =
compute_state_update_lambert(h, unorm, L, s4_old[i][0]); compute_state_update_lambert(h, unorm, L, s4_old[i][0]);
assert(std::abs(1.0 / h * ret2 - (s4_old[i] - unorm / L) / h - assert(std::abs(1.0 / h * ret2 - (s4_old[i] - unorm / L) / h -
exp(-ret2)) < 1e-10); std::exp(-ret2)) < 1e-10);
double ret3 = double ret3 =
compute_state_update_lambert_gsl(h, unorm, L, s4_old[i][0]); compute_state_update_lambert_gsl(h, unorm, L, s4_old[i][0]);
assert(std::abs(1.0 / h * ret3 - (s4_old[i] - unorm / L) / h - assert(std::abs(1.0 / h * ret3 - (s4_old[i] - unorm / L) / h -
exp(-ret3)) < 1e-10); std::exp(-ret3)) < 1e-10);
assert(std::abs(ret1 - ret2) < 1e-14); assert(std::abs(ret1 - ret2) < 1e-14);
assert(std::abs(ret1 - ret3) < 1e-14); assert(std::abs(ret1 - ret3) < 1e-14);
...@@ -426,17 +426,17 @@ int main(int argc, char *argv[]) { ...@@ -426,17 +426,17 @@ int main(int argc, char *argv[]) {
double ret1 = double ret1 =
compute_state_update_bisection(h, unorm, L, s5_old[i][0]); compute_state_update_bisection(h, unorm, L, s5_old[i][0]);
assert(std::abs(1.0 / h * ret1 - (s5_old[i] - unorm / L) / h - assert(std::abs(1.0 / h * ret1 - (s5_old[i] - unorm / L) / h -
exp(-ret1)) < 1e-12); std::exp(-ret1)) < 1e-12);
double ret2 = double ret2 =
compute_state_update_lambert(h, unorm, L, s5_old[i][0]); compute_state_update_lambert(h, unorm, L, s5_old[i][0]);
assert(std::abs(1.0 / h * ret2 - (s5_old[i] - unorm / L) / h - assert(std::abs(1.0 / h * ret2 - (s5_old[i] - unorm / L) / h -
exp(-ret2)) < 1e-12); std::exp(-ret2)) < 1e-12);
double ret3 = double ret3 =
compute_state_update_lambert_gsl(h, unorm, L, s4_old[i][0]); compute_state_update_lambert_gsl(h, unorm, L, s4_old[i][0]);
assert(std::abs(1.0 / h * ret3 - (s4_old[i] - unorm / L) / h - assert(std::abs(1.0 / h * ret3 - (s4_old[i] - unorm / L) / h -
exp(-ret3)) < 1e-10); std::exp(-ret3)) < 1e-10);
assert(std::abs(ret1 - ret2) < 1e-14); assert(std::abs(ret1 - ret2) < 1e-14);
assert(std::abs(ret1 - ret3) < 1e-14); assert(std::abs(ret1 - ret3) < 1e-14);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment