diff --git a/src/checks.c b/src/checks.c
index c72b55f62..6a7350467 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -540,7 +540,8 @@ void process_chk(struct task *t, struct timeval *next)
}
else if (s->proxy->lbprm.algo & BE_LB_PROP_DYN) {
/* for dynamic algorithms, let's update the weight */
- s->eweight = BE_WEIGHT_SCALE * (now.tv_sec - s->last_change) / s->slowstart;
+ s->eweight = (BE_WEIGHT_SCALE * (now.tv_sec - s->last_change) +
+ s->slowstart - 1) / s->slowstart;
s->eweight *= s->uweight;
if (s->proxy->lbprm.update_server_eweight)
s->proxy->lbprm.update_server_eweight(s);
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 9531773f7..6d4ea5440 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -767,7 +767,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri,
/* act, bck */
"
%s | %s | "
"",
- sv->eweight * px->lbprm.wmult / px->lbprm.wdiv,
+ (sv->eweight * px->lbprm.wmult + px->lbprm.wdiv - 1) / px->lbprm.wdiv,
(sv->state & SRV_BACKUP) ? "-" : "Y",
(sv->state & SRV_BACKUP) ? "Y" : "-");
@@ -834,7 +834,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri,
/* weight, active, backup */
"%d,%d,%d,"
"",
- sv->eweight * px->lbprm.wmult / px->lbprm.wdiv,
+ (sv->eweight * px->lbprm.wmult + px->lbprm.wdiv - 1) / px->lbprm.wdiv,
(sv->state & SRV_BACKUP) ? 0 : 1,
(sv->state & SRV_BACKUP) ? 1 : 0);
@@ -910,7 +910,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri,
human_time(now.tv_sec - px->last_change, 1),
(px->lbprm.tot_weight > 0 || !px->srv) ? "UP" :
"DOWN",
- px->lbprm.tot_weight * px->lbprm.wmult / px->lbprm.wdiv,
+ (px->lbprm.tot_weight * px->lbprm.wmult + px->lbprm.wdiv - 1) / px->lbprm.wdiv,
px->srv_act, px->srv_bck);
chunk_printf(&msg, sizeof(trash),
@@ -956,7 +956,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri,
px->failed_conns, px->failed_resp,
px->retries, px->redispatches,
(px->lbprm.tot_weight > 0 || !px->srv) ? "UP" : "DOWN",
- px->lbprm.tot_weight * px->lbprm.wmult / px->lbprm.wdiv,
+ (px->lbprm.tot_weight * px->lbprm.wmult + px->lbprm.wdiv - 1) / px->lbprm.wdiv,
px->srv_act, px->srv_bck,
px->down_trans, now.tv_sec - px->last_change,
px->srv?be_downtime(px):0,