3 ms·
Once you care about that level of performance, you can surely optimise your representation to have a greater range (use more bits for the numerator) or greater
by dmurray 7y ago
Once you care about that level of performance, you can surely optimise your representation to have a greater range (use more bits for the numerator) or greater precision (more bits for the denominator) or some boutique solution like using three integers to store the number a + b/c.
You can store slightly fewer numbers with rationals, because it's hard to avoid having a representation for both 2/4 and 3/6. But the loss of range or precision due to that is pretty small.