From 334d23762a09eca957ff1dda0a6027a66d989736 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Sat, 20 Aug 2016 18:04:51 +0100 Subject: [PATCH] Removed some double --> float conversions that slipped under the carpet --- src/gravity/Default/gravity.h | 6 +++--- src/kernel_gravity.h | 2 +- src/kernel_long_gravity.h | 2 +- src/kick.h | 8 ++++---- src/runner_doiact.h | 6 +++--- src/scheduler.c | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/gravity/Default/gravity.h b/src/gravity/Default/gravity.h index da6b9aa01d..d4249c46a3 100644 --- a/src/gravity/Default/gravity.h +++ b/src/gravity/Default/gravity.h @@ -71,7 +71,7 @@ gravity_compute_timestep_self(const struct phys_const* const phys_const, const float ac = (ac2 > 0.f) ? sqrtf(ac2) : FLT_MIN; - const float dt = sqrt(2.f * const_gravity_eta * gp->epsilon / ac); + const float dt = sqrtf(2.f * const_gravity_eta * gp->epsilon / ac); return dt; } @@ -115,10 +115,10 @@ __attribute__((always_inline)) INLINE static void gravity_init_gpart( * Multiplies the forces and accelerations by the appropiate constants * * @param gp The particle to act upon - * @param const_G Newton's constant + * @param const_G Newton's constant in internal units */ __attribute__((always_inline)) INLINE static void gravity_end_force( - struct gpart* gp, double const_G) { + struct gpart* gp, float const_G) { /* Let's get physical... */ gp->a_grav[0] *= const_G; diff --git a/src/kernel_gravity.h b/src/kernel_gravity.h index b38feb5758..a1e382a21d 100644 --- a/src/kernel_gravity.h +++ b/src/kernel_gravity.h @@ -50,7 +50,7 @@ static const float -10.66666667f, 38.4f, -48.f, - 21.3333333, + 21.3333333f, 0.f, 0.f, -0.066666667f, /* 0.5 < u < 1 */ diff --git a/src/kernel_long_gravity.h b/src/kernel_long_gravity.h index d247c7a461..6952681999 100644 --- a/src/kernel_long_gravity.h +++ b/src/kernel_long_gravity.h @@ -41,7 +41,7 @@ __attribute__((always_inline)) INLINE static void kernel_long_grav_eval( const float arg2 = u * one_over_sqrt_pi; const float arg3 = -arg1 * arg1; - const float term1 = erfc(arg1); + const float term1 = erfcf(arg1); const float term2 = arg2 * expf(arg3); *W = term1 + term2; diff --git a/src/kick.h b/src/kick.h index b57e13d4eb..e3fa3bf78c 100644 --- a/src/kick.h +++ b/src/kick.h @@ -39,8 +39,8 @@ __attribute__((always_inline)) INLINE static void kick_gpart( /* Compute the time step for this kick */ const int ti_start = (gp->ti_begin + gp->ti_end) / 2; const int ti_end = gp->ti_end + new_dti / 2; - const double dt = (ti_end - ti_start) * timeBase; - const double half_dt = (ti_end - gp->ti_end) * timeBase; + const float dt = (ti_end - ti_start) * timeBase; + const float half_dt = (ti_end - gp->ti_end) * timeBase; /* Move particle forward in time */ gp->ti_begin = gp->ti_end; @@ -70,8 +70,8 @@ __attribute__((always_inline)) INLINE static void kick_part( /* Compute the time step for this kick */ const int ti_start = (p->ti_begin + p->ti_end) / 2; const int ti_end = p->ti_end + new_dti / 2; - const double dt = (ti_end - ti_start) * timeBase; - const double half_dt = (ti_end - p->ti_end) * timeBase; + const float dt = (ti_end - ti_start) * timeBase; + const float half_dt = (ti_end - p->ti_end) * timeBase; /* Move particle forward in time */ p->ti_begin = p->ti_end; diff --git a/src/runner_doiact.h b/src/runner_doiact.h index e7af840b54..3764009264 100644 --- a/src/runner_doiact.h +++ b/src/runner_doiact.h @@ -1739,7 +1739,7 @@ void DOSUB_PAIR1(struct runner *r, struct cell *ci, struct cell *cj, int sid, if (ci->ti_end_min > ti_current && cj->ti_end_min > ti_current) return; /* Get the cell dimensions. */ - const float h = fmin(ci->width[0], fmin(ci->width[1], ci->width[2])); + const float h = fminf(ci->width[0], fminf(ci->width[1], ci->width[2])); /* Get the type of pair if not specified explicitly. */ // if ( sid < 0 ) @@ -2023,7 +2023,7 @@ void DOSUB_PAIR2(struct runner *r, struct cell *ci, struct cell *cj, int sid, if (ci->ti_end_min > ti_current && cj->ti_end_min > ti_current) return; /* Get the cell dimensions. */ - const float h = fmin(ci->width[0], fmin(ci->width[1], ci->width[2])); + const float h = fminf(ci->width[0], fminf(ci->width[1], ci->width[2])); /* Get the type of pair if not specified explicitly. */ // if ( sid < 0 ) @@ -2336,7 +2336,7 @@ void DOSUB_SUBSET(struct runner *r, struct cell *ci, struct part *parts, else { /* Get the cell dimensions. */ - const float h = fmin(ci->width[0], fmin(ci->width[1], ci->width[2])); + const float h = fminf(ci->width[0], fminf(ci->width[1], ci->width[2])); /* Recurse? */ if (ci->split && cj->split && diff --git a/src/scheduler.c b/src/scheduler.c index 5c3b803a0c..b83604ca8b 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -116,9 +116,9 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) { {-1, -1, -1, 12, 7, 6, 4, 3}, {-1, -1, -1, -1, 8, 7, 5, 4}, {-1, -1, -1, -1, -1, 12, 10, 9}, {-1, -1, -1, -1, -1, -1, 11, 10}, {-1, -1, -1, -1, -1, -1, -1, 12}}; - static const float sid_scale[13] = {0.1897, 0.4025, 0.1897, 0.4025, 0.5788, - 0.4025, 0.1897, 0.4025, 0.1897, 0.4025, - 0.5788, 0.4025, 0.5788}; + static const float sid_scale[13] = {0.1897f, 0.4025f, 0.1897f, 0.4025f, 0.5788f, + 0.4025f, 0.1897f, 0.4025f, 0.1897f, 0.4025f, + 0.5788f, 0.4025f, 0.5788f}; /* Iterate on this task until we're done with it. */ int redo = 1; -- GitLab