Batting Average Calculator
Batting average is hits divided by at-bats, and the only place it goes wrong is the denominator: a walk, a hit by pitch and a sacrifice are plate appearances but not at-bats. Enter hits and at-bats for the average on its own, or add the doubles, triples, home runs, walks, hit by pitches and sacrifice flies and the same line also gives total bases, slugging percentage, on-base percentage and OPS. A second mode takes the season so far and the at-bats still to come and works out how many more hits a target average needs, the rate that implies over those at-bats, and what happens if one hit does not come. Everything is shown to three decimal places without the leading zero, the way a box score prints it.