3 ms·
Rational numbers don't lose precision, but the compromise is that they can get arbitrarily large after a series of calculations, even if the calculations themse
by tikhonj 8y ago
Rational numbers don't lose precision, but the compromise is that they can get arbitrarily large after a series of calculations, even if the calculations themselves involve small numbers.
Having access to rational numbers is great and there are times they are incredibly useful, but I don't think it's a good default.
- dpwm 8y agoFor monetary values, though, the denominators should be the same. This means that the denominator won't get arbitrarily large. For serious uses of rationals you need to have control over when the top and bottom are divided by the GCD. For currency you want to keep the denominator at 100. 50/100 wants to remain as that and not get simplified to 1/2.
- Retra 8y agoIf you have a constant denominator, you don't need it. It's just a unit.