Joe Nelson wrote:
> where the denominator is made positive whenever possible (not possible
> when it's -INT_MAX).
(I meant INT_MIN rather than -INT_MAX.)
Another more-than-one-way-to-do-it task is converting a float to a
fraction. I translated John Kennedy's method [0] to C, but Github user
adegert sent an alternative [1] that matches the way the CPython
implementation works.
0: https://begriffs.com/pdf/dec2frac.pdf
1: https://github.com/begriffs/pg_rational/pull/13