Commit 4ad67114 authored by Josh Borrow's avatar Josh Borrow
Browse files

Changed to using correct versions of expf and caching the result; unsure if...

Changed to using correct versions of expf and caching the result; unsure if this is correct still, though
parent 1695c6cf
......@@ -535,11 +535,13 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
/* Predict density and weighted pressure */
const float w2 = -hydro_dimension * w1;
if (fabsf(w2) < 0.2f) {
p->rho *= approx_expf(w2); /* 4th order expansion of exp(w) */
p->pressure_bar *= approx_expf(w2);
const float expf_approx = approx_expf(w2); /* 4th order expansion of exp(w) */
p->rho *= expf_approx;
p->pressure_bar *= expf_approx;
} else {
p->rho *= expf(w2);
p->pressure_bar *= approx_expf(w2);
const float expf_exact = expf(w2);
p->rho *= expf_exact;
p->pressure_bar *= expf_exact;
}
/* Predict the internal energy */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment