Commit ffd3f7d7 authored by erwan's avatar erwan
Browse files

fix: -is/-gis avoid a division by 0 when used with a #simu < 100

parent 2440d90f
Pipeline #96688 passed with stages
in 4 minutes and 25 seconds
(* Time-stamp: <modified the 14/04/2022 (at 17:20) by Erwan Jahier> *)
(* Time-stamp: <modified the 19/04/2022 (at 15:20) by Erwan Jahier> *)
open Register
......@@ -221,7 +221,8 @@ let (fchc : out_channel -> ('v SimuState.t -> int) -> 'v SimuState.t -> int
map_local_fold
~f: (fun p -> cost p, p)
~fold:(fun (cpt,nl) (c,p) ->
let n_percent_done = cpt / (dmax / 100) in
assert(dmax <> 0);
let n_percent_done = if dmax < 100 then 1 else cpt / (dmax / 100) in
if n_percent_done <> !percent_done then (
percent_done := n_percent_done;
Printf.printf "%d%% of the %d simulations have been tryied so far...\r%!"
......@@ -321,7 +322,7 @@ let (global : out_channel -> ('v SimuState.t -> int) -> 'v SimuState.t -> int
else
ss_worst, worst
in
let n_percent_done = cpt / (dmax / 100) in
let n_percent_done = if dmax < 100 then 1 else cpt / (dmax / 100) in
if n_percent_done <> !percent_done then (
percent_done := n_percent_done;
Printf.printf "%d%% of the %d simulations have been tryied so far...\r%!"
......
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