Mathematics.Fractions (Package)


It's fractions. The performance sucks, but every representable number has perfect accuracy. You almost certainly shouldn't be using these. Even if you think you need them, you're probably wrong.


Check out fixed-point binary or decimal types first, as you almost certainly want these instead. If precision is absolutely critical and for some reason those do not suffice, you're probably doing something wrong, but these will solve the problem if you actually aren't.

If you do actually have a legitimate use for these, know that reduction does not occur automatically, as this would even further worsen performance. Know roughly when it should be done, catch the overflow exception and do it, or do it after every operation; whatever works best for the given implementation.