[swift-evolution] Proposal: A standard library Fraction type
Matthew Johnson
matthew at anandabits.com
Mon Dec 7 09:50:30 CST 2015
> If your implementation of Rational simplifies immediately, sure. Mine doesn't and it is useful in many other cases not to as well. You might, for example, want to present the original numerator/denominator provided by the user.
How does your implementation implement equality? From a numeric standpoint I think most people would consider 3/4 to be equal to 6/8 whereas this would not be correct for a time signature.
In any case, I agree that a rational type would be a useful addition to the library. I don't think I would use it to model time signatures but there are plenty of other uses.
More information about the swift-evolution
mailing list