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
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера