See https://github.com/Shopify/measured/issues/63 for more context. tl;dr Rational is faster for arithmetic and can represent values that BigDecimal cannot, but slower for parsing decimal numbers. Since the construction of units and the conversion table is a one-off operation, Rational is the best for representing things, especially since conversions are arithmetic operations.
See https://github.com/Shopify/measured/issues/63 for more context. tl;dr
Rational
is faster for arithmetic and can represent values thatBigDecimal
cannot, but slower for parsing decimal numbers. Since the construction of units and the conversion table is a one-off operation,Rational
is the best for representing things, especially since conversions are arithmetic operations.Mostly takes care of https://github.com/Shopify/measured/issues/63, but I have some other changes that I want to make that'll fully close it.