Skip to content

Commit a894b49

Browse files
Update libCacheSim/bin/cachesim/main.c
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 144650c commit a894b49

File tree

1 file changed

+3
-1
lines changed
  • libCacheSim/bin/cachesim

1 file changed

+3
-1
lines changed

libCacheSim/bin/cachesim/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ int main(int argc, char **argv) {
8484
if (!args.ignore_obj_size)
8585
n += snprintf(
8686
output_str + n, sizeof(output_str) - n, ", byte miss ratio %.4lf",
87-
(double)result[i].n_miss_byte / (double)result[i].n_req_byte);
87+
result[i].n_req_byte > 0
88+
? (double)result[i].n_miss_byte / (double)result[i].n_req_byte
89+
: 0.0);
8890
if (show_cost)
8991
n += snprintf(output_str + n, sizeof(output_str) - n,
9092
", cost saving ratio %.4lf", cost_saving_ratio);

0 commit comments

Comments
 (0)