Skip to content

Commit

Permalink
Fix divide by zero error of x86
Browse files Browse the repository at this point in the history
  • Loading branch information
reiniscirpons committed Nov 23, 2023
1 parent a9f479e commit 9ba2fac
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/sims1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ namespace libsemigroups {
// ReporterV3
auto now = std::chrono::high_resolution_clock::now();
auto time_total_ns = duration_cast<nanoseconds>(now - start_time());
auto time_total_s = duration_cast<seconds>(time_total_ns);
auto time_total_s = duration_cast<seconds>(time_total_ns).count();
auto time_diff = duration_cast<nanoseconds>(now - last_report());

// Stats
Expand All @@ -841,15 +841,21 @@ namespace libsemigroups {
signed_group_digits(count_diff),
signed_group_digits(total_pending_diff));
rc("Sims1: mean {} (cong./s) | {} (node/s)\n",
group_digits(stats().count_now / time_total_s.count()),
group_digits(stats().total_pending_now / time_total_s.count()));
group_digits(time_total_s == 0 ? 0 : stats().count_now / time_total_s),
group_digits(
time_total_s == 0 ? 0 : stats().total_pending_now / time_total_s));
rc("Sims1: time last s. {} (/cong.) | {} (/node)\n",
count_diff == 0 ? "x" : string_time(time_diff / count_diff),
total_pending_diff == 0 ? "x"
: string_time(time_diff / total_pending_diff));
rc("Sims1: mean time {} (/cong.) | {} (/node)\n",
string_time(time_total_ns / stats().count_now.load()),
string_time(time_total_ns / stats().total_pending_now.load()));
string_time(stats().count_now.load() == 0
? decltype(time_total_ns / stats().count_now.load())(0)
: time_total_ns / stats().count_now.load()),
string_time(
stats().total_pending_now.load() == 0
? decltype(time_total_ns / stats().total_pending_now.load())(0)
: time_total_ns / stats().total_pending_now.load()));
rc("Sims1: time {} (total) |\n", string_time(time_total_ns));

last_report(now);
Expand Down

0 comments on commit 9ba2fac

Please sign in to comment.