- my $drop_rate = $buckets{$n}->{'num_drops'} / ($n * $buckets{$n}->{'num_bursts'});
- my $drop_event_rate = ($buckets{$n}->{'bursts_with_drops'} // 0) / $buckets{$n}->{'num_bursts'};
+ my $num_bursts = $buckets{$n}->{'num_bursts'} // 0;
+ my $num_drops = $buckets{$n}->{'num_drops'} // 0;
+ my $bursts_with_drops = $buckets{$n}->{'bursts_with_drops'} // 0;
+
+ my $drop_rate = $num_drops / ($n * $num_bursts);
+ my $drop_event_rate = $bursts_with_drops / $num_bursts;