a14n / dart-rational

Apache License 2.0
35 stars 20 forks source link

const Rational #22

Closed modulovalue closed 5 years ago

modulovalue commented 5 years ago

Rationals should have a const constructor and https://github.com/dart-lang/sdk/issues/33893 is preventing that from happening. Is that observation correct?

a14n commented 5 years ago

That's not the only issue. In Rational._normalized there's a check to ensure GCD of numerator and denominator is 1. This will prevent Rational to be const.