TabletopAssistant / DiceKit

Swift framework for expressing and evaluating dice notation (e.g., d20, 4d6+4, 3d8×10+2), which is commonly used in tabletop role-playing games.
Apache License 2.0
14 stars 1 forks source link

Convert Frequency to a Rational type #111

Open brentleyjones opened 8 years ago

brentleyjones commented 8 years ago

Currently Frequency is implemented as a Double. While the end result is fine as a double, we have issues with comparing the frequencies (like when we are eliminating zeroes) or losing precision with operations. By using a Rational type we would keep accuracy until the very end, where we can then decide (or not) to convert it to a double.