Step 5 of 6
Review: integer math
Numeric code gets reviewed for four things: overflow, division by zero, signed/unsigned mix-ups, and empty input.
Your turn: this pull request adds stats for the match history page. The specification:
win_rate(wins, games): whole-number percentage, rounded down; 0 when there are no games. It must work for career totals in the billions.average(scores): the mean as a double; 0.0 for no scores. Scores can be large.last_n_total(scores, n): the sum of the lastnscores (all of them if there are fewer than n).
There are four bugs.
Previous: Review: modifying while iterating Next: Review: class design