fix #2 with a formula found at http://www.math.miami.edu/~jam/azure/compendium/battdam.htm