On Thu, Jun 1, 2023 at 10:35 AM Brian Goetz <[email protected]> wrote:

Rational is unfortunate because the default representation (when used
> improperly) can lead to DBZE, but has a sensible default of zero -- except
> for that pesky denominator.  However, I think this is a removable
> discontinuity, where the author can make up for this with some careful
> coding:
>

It helps a bit that you want to canonicalize all 0/n to *something* anyway,
and rational operations are already busy taking the gcd and ensuring
positive denominator as it is. The need to internally represent zero as 0/0
probably adds little incremental pain in *this* case, but there will be
others where it does. Still, overall it seems like a very fine trade-off.


-- 
Kevin Bourrillion | Java/Kotlin Ecosystem Team | Google, Inc. |
[email protected]

Reply via email to